Skip to content

Instantly share code, notes, and snippets.

@kitze
Created February 12, 2020 09:26
Show Gist options
  • Save kitze/6e6bd693b8cbafb8c7a7679b3afa5ef8 to your computer and use it in GitHub Desktop.
Save kitze/6e6bd693b8cbafb8c7a7679b3afa5ef8 to your computer and use it in GitHub Desktop.
Cast Self for mobx-state-tree
import { Instance, cast } from 'mobx-state-tree';
export function castSelf<IStoreInstance, IParentModel>(
store: IStoreInstance,
model: IParentModel
) {
return cast<Instance<IParentModel>>(store as Instance<IParentModel>);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment