blob: 4405338ba36a185399fcf716e2e484b2e91ed781 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { Instance, SnapshotOut, types } from 'mobx-state-tree'
/**
* Rick and Morty character model.
*/
export const CharacterModel = types.model('Character').props({
id: types.identifierNumber,
name: types.maybe(types.string),
status: types.maybe(types.string),
image: types.maybe(types.string),
})
type CharacterType = Instance<typeof CharacterModel>
export interface Character extends CharacterType {}
type CharacterSnapshotType = SnapshotOut<typeof CharacterModel>
export interface CharacterSnapshot extends CharacterSnapshotType {}
export const createCharacterDefaultModel = () => types.optional(CharacterModel, {})
|