Created
February 12, 2020 09:26
-
-
Save kitze/6e6bd693b8cbafb8c7a7679b3afa5ef8 to your computer and use it in GitHub Desktop.
Cast Self for mobx-state-tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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