MobX-state-tree

MobX-state-tree

  • Documentation
  • TypeDocs
  • Sponsor
  • GitHub

›Interfaces

Introduction

  • Globals

Interfaces

  • CustomTypeOptions
  • FunctionWithFlag
  • IActionContext
  • IActionRecorder
  • IActionTrackingMiddleware2Call
  • IActionTrackingMiddleware2Hooks
  • IActionTrackingMiddlewareHooks
  • IAnyComplexType
  • IAnyModelType
  • IAnyType
  • IHooks
  • IJsonPatch
  • IMiddlewareEvent
  • IModelReflectionData
  • IModelReflectionPropertiesData
  • IModelType
  • IPatchRecorder
  • IReversibleJsonPatch
  • ISerializedActionCall
  • ISimpleType
  • ISnapshotProcessor
  • ISnapshotProcessors
  • IType
  • IValidationContextEntry
  • IValidationError
  • ReferenceOptionsGetSet
  • ReferenceOptionsOnInvalidated
  • UnionOptions
Edit

IModelType

mobx-state-tree - v7.0.2 › IModelType

Type parameters

▪ PROPS: ModelProperties

▪ OTHERS

▪ CustomC

▪ CustomS

Hierarchy

  • IType‹ModelCreationType2‹PROPS, CustomC›, ModelSnapshotType2‹PROPS, CustomS›, ModelInstanceType‹PROPS, OTHERS››

    ↳ IModelType

    ↳ IAnyModelType

Index

Properties

  • identifierAttribute
  • name
  • properties

Methods

  • actions
  • create
  • describe
  • extend
  • is
  • named
  • postProcessSnapshot
  • preProcessSnapshot
  • props
  • validate
  • views
  • volatile

Properties

Optional identifierAttribute

• identifierAttribute? : undefined | string

Inherited from IType.identifierAttribute

Defined in src/core/type/type.ts:92

Name of the identifier attribute or null if none.


name

• name: string

Inherited from IType.name

Defined in src/core/type/type.ts:87

Friendly type name.


properties

• properties: PROPS

Defined in src/types/complex-types/model.ts:195

Methods

actions

▸ actions<A>(fn: function): IModelType‹PROPS, OTHERS & A, CustomC, CustomS›

Defined in src/types/complex-types/model.ts:209

Type parameters:

▪ A: ModelActions

Parameters:

▪ fn: function

▸ (self: Instance‹this›): A

Parameters:

NameType
selfInstance‹this›

Returns: IModelType‹PROPS, OTHERS & A, CustomC, CustomS›


create

▸ create(snapshot?: ModelCreationType2‹PROPS, CustomC› | ExcludeReadonly‹ModelInstanceType‹PROPS, OTHERS››, env?: any): this["Type"]

Inherited from IType.create

Defined in src/core/type/type.ts:99

Creates an instance for the type given an snapshot input.

Parameters:

NameType
snapshot?ModelCreationType2‹PROPS, CustomC› | ExcludeReadonly‹ModelInstanceType‹PROPS, OTHERS››
env?any

Returns: this["Type"]

An instance of that type.


describe

▸ describe(): string

Inherited from IType.describe

Defined in src/core/type/type.ts:121

Gets the textual representation of the type as a string.

Returns: string


extend

▸ extend<A, V, VS>(fn: function): IModelType‹PROPS, OTHERS & A & V & VS, CustomC, CustomS›

Defined in src/types/complex-types/model.ts:217

Type parameters:

▪ A: ModelActions

▪ V: Object

▪ VS: Object

Parameters:

▪ fn: function

▸ (self: Instance‹this›): object

Parameters:

NameType
selfInstance‹this›

Returns: IModelType‹PROPS, OTHERS & A & V & VS, CustomC, CustomS›


is

▸ is(thing: any): thing is ModelCreationType2<PROPS, CustomC> | this["Type"]

Inherited from IType.is

Defined in src/core/type/type.ts:107

Checks if a given snapshot / instance is of the given type.

Parameters:

NameTypeDescription
thinganySnapshot or instance to be checked.

Returns: thing is ModelCreationType2<PROPS, CustomC> | this["Type"]

true if the value is of the current type, false otherwise.


named

▸ named(newName: string): IModelType‹PROPS, OTHERS, CustomC, CustomS›

Defined in src/types/complex-types/model.ts:197

Parameters:

NameType
newNamestring

Returns: IModelType‹PROPS, OTHERS, CustomC, CustomS›


postProcessSnapshot

▸ postProcessSnapshot<NewS>(fn: function): IModelType‹PROPS, OTHERS, CustomC, NewS›

Defined in src/types/complex-types/model.ts:225

Type parameters:

▪ NewS

Parameters:

▪ fn: function

▸ (snapshot: ModelSnapshotType2‹PROPS, CustomS›): NewS

Parameters:

NameType
snapshotModelSnapshotType2‹PROPS, CustomS›

Returns: IModelType‹PROPS, OTHERS, CustomC, NewS›


preProcessSnapshot

▸ preProcessSnapshot<NewC>(fn: function): IModelType‹PROPS, OTHERS, NewC, CustomS›

Defined in src/types/complex-types/model.ts:221

Type parameters:

▪ NewC

Parameters:

▪ fn: function

▸ (snapshot: NewC): WithAdditionalProperties‹ModelCreationType2‹PROPS, CustomC››

Parameters:

NameType
snapshotNewC

Returns: IModelType‹PROPS, OTHERS, NewC, CustomS›


props

▸ props<PROPS2>(props: PROPS2): IModelType‹PROPS & ModelPropertiesDeclarationToProperties‹PROPS2›, OTHERS, CustomC, CustomS›

Defined in src/types/complex-types/model.ts:201

Type parameters:

▪ PROPS2: ModelPropertiesDeclaration

Parameters:

NameType
propsPROPS2

Returns: IModelType‹PROPS & ModelPropertiesDeclarationToProperties‹PROPS2›, OTHERS, CustomC, CustomS›


validate

▸ validate(thing: ModelCreationType2‹PROPS, CustomC› | ModelInstanceType‹PROPS, OTHERS›, context: IValidationContext): IValidationResult

Inherited from IType.validate

Defined in src/core/type/type.ts:116

Run's the type's typechecker on the given value with the given validation context.

Parameters:

NameTypeDescription
thingModelCreationType2‹PROPS, CustomC› | ModelInstanceType‹PROPS, OTHERS›Value to be checked, either a snapshot or an instance.
contextIValidationContextValidation context, an array of { subpaths, subtypes } that should be validated

Returns: IValidationResult

The validation result, an array with the list of validation errors.


views

▸ views<V>(fn: function): IModelType‹PROPS, OTHERS & V, CustomC, CustomS›

Defined in src/types/complex-types/model.ts:205

Type parameters:

▪ V: Object

Parameters:

▪ fn: function

▸ (self: Instance‹this›): V

Parameters:

NameType
selfInstance‹this›

Returns: IModelType‹PROPS, OTHERS & V, CustomC, CustomS›


volatile

▸ volatile<TP>(fn: function): IModelType‹PROPS, OTHERS & TP, CustomC, CustomS›

Defined in src/types/complex-types/model.ts:213

Type parameters:

▪ TP: object

Parameters:

▪ fn: function

▸ (self: Instance‹this›): TP

Parameters:

NameType
selfInstance‹this›

Returns: IModelType‹PROPS, OTHERS & TP, CustomC, CustomS›

← IModelReflectionPropertiesDataIPatchRecorder →
  • Type parameters
  • Hierarchy
  • Index
    • Properties
    • Methods
  • Properties
    • Optional identifierAttribute
    • name
    • properties
  • Methods
    • actions
    • create
    • describe
    • extend
    • is
    • named
    • postProcessSnapshot
    • preProcessSnapshot
    • props
    • validate
    • views
    • volatile
MobX-state-tree
Docs
Getting StartedBasic conceptsAdvanced conceptsAPI Reference
Community
GitHub DiscussionsStack Overflow
More
BlogGitHubStar
Facebook Open Source
Copyright © 2025 Michel Weststrate