Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
feat(mobx): Update to mobx-state-tree version 3.12.2 (#166 by @guhungry)
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
guhungry authored and jamonholmgren committed Apr 9, 2019
1 parent b737f08 commit 7911213
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
6 changes: 3 additions & 3 deletions boilerplate/app/models/root-store/root-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { types } from "mobx-state-tree"
import { Instance, SnapshotOut, types } from "mobx-state-tree"
import { NavigationStoreModel } from "../../navigation/navigation-store"

/**
Expand All @@ -11,9 +11,9 @@ export const RootStoreModel = types.model("RootStore").props({
/**
* The RootStore instance.
*/
export type RootStore = typeof RootStoreModel.Type
export type RootStore = Instance<typeof RootStoreModel>

/**
* The data of an RootStore.
*/
export type RootStoreSnapshot = typeof RootStoreModel.SnapshotType
export type RootStoreSnapshot = SnapshotOut<typeof RootStoreModel>
6 changes: 3 additions & 3 deletions boilerplate/app/navigation/navigation-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { types } from "mobx-state-tree"
import { Instance, types } from "mobx-state-tree"
import { RootNavigator } from "./root-navigator"
import { NavigationActions, NavigationAction } from "react-navigation"
import { NavigationEvents } from "./navigation-events"
Expand Down Expand Up @@ -27,7 +27,7 @@ export const NavigationStoreModel = NavigationEvents.named("NavigationStore")
/**
* the navigation state tree (Frozen here means it is immutable.)
*/
state: types.optional(types.frozen, DEFAULT_STATE),
state: types.optional(types.frozen(), DEFAULT_STATE),
})
.actions(self => ({

Expand Down Expand Up @@ -78,4 +78,4 @@ export const NavigationStoreModel = NavigationEvents.named("NavigationStore")
},
}))

export type NavigationStore = typeof NavigationStoreModel.Type
export type NavigationStore = Instance<typeof NavigationStoreModel>
6 changes: 3 additions & 3 deletions boilerplate/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"dependencies": {
"apisauce": "0.16.0",
"lodash.throttle": "4.1.1",
"mobx": "4.2.1",
"mobx-react": "5.2.8",
"mobx-state-tree": "2.0.5",
"mobx": "^4.9.4",
"mobx-react": "^5.4.3",
"mobx-state-tree": "^3.12.2",
"ramda": "0.25.0",
"react-native-languages": "^3.0.0",
"i18n-js": "^3.0.11",
Expand Down
12 changes: 5 additions & 7 deletions templates/model.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { types } from "mobx-state-tree"
import { Instance, SnapshotOut, types } from "mobx-state-tree"

/**
* Model description here for TypeScript hints.
Expand All @@ -14,12 +14,10 @@ export const <%= props.pascalName %>Model = types
* Useful for sensitive data like passwords, or transitive state like whether a modal is open.

* Note that you'll need to import `omit` from ramda, which is already included in the project!
* .actions(self => ({
* postProcessSnapshot: omit(["password", "socialSecurityNumber", "creditCardNumber"]),
* }))
* .postProcessSnapshot(omit(["password", "socialSecurityNumber", "creditCardNumber"]))
*/

type <%= props.pascalName %>Type = typeof <%= props.pascalName %>Model.Type
type <%= props.pascalName %>Type = Instance<typeof <%= props.pascalName %>Model>
export interface <%= props.pascalName %> extends <%= props.pascalName %>Type {}
type <%= props.pascalName %>SnapshotType = typeof <%= props.pascalName %>Model.SnapshotType
export interface <%= props.pascalName %>Snapshot extends <%= props.pascalName %>SnapshotType {}
type <%= props.pascalName %>SnapshotType = SnapshotOut<typeof <%= props.pascalName %>Model>
export interface <%= props.pascalName %>Snapshot extends <%= props.pascalName %>SnapshotType {}

0 comments on commit 7911213

Please sign in to comment.