blob: eff769c59792755538b363eb7f3ba80f7263e63e (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { getRoot, IStateTreeNode } from "mobx-state-tree"
import { RootStoreModel } from "../root-store/root-store"
/**
* Adds a rootStore property to the node for a convenient
* and strongly typed way for stores to access other stores.
*/
export const withRootStore = (self: IStateTreeNode) => ({
views: {
/**
* The root store.
*/
get rootStore() {
return getRoot<typeof RootStoreModel>(self)
},
},
})
|