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

CustomTypeOptions

mobx-state-tree - v7.0.2 › CustomTypeOptions

Type parameters

▪ S

▪ T

Hierarchy

  • CustomTypeOptions

Index

Properties

  • name

Methods

  • fromSnapshot
  • getValidationMessage
  • isTargetType
  • toSnapshot

Properties

name

• name: string

Defined in src/types/utility-types/custom.ts:15

Friendly name

Methods

fromSnapshot

▸ fromSnapshot(snapshot: S, env?: any): T

Defined in src/types/utility-types/custom.ts:17

given a serialized value and environment, how to turn it into the target type

Parameters:

NameType
snapshotS
env?any

Returns: T


getValidationMessage

▸ getValidationMessage(snapshot: S): string

Defined in src/types/utility-types/custom.ts:23

a non empty string is assumed to be a validation error

Parameters:

NameType
snapshotS

Returns: string


isTargetType

▸ isTargetType(value: T | S): boolean

Defined in src/types/utility-types/custom.ts:21

if true, this is a converted value, if false, it's a snapshot

Parameters:

NameType
valueT | S

Returns: boolean


toSnapshot

▸ toSnapshot(value: T): S

Defined in src/types/utility-types/custom.ts:19

return the serialization of the current value

Parameters:

NameType
valueT

Returns: S

← GlobalsFunctionWithFlag →
  • Type parameters
  • Hierarchy
  • Index
    • Properties
    • Methods
  • Properties
    • name
  • Methods
    • fromSnapshot
    • getValidationMessage
    • isTargetType
    • toSnapshot
MobX-state-tree
Docs
Getting StartedBasic conceptsAdvanced conceptsAPI Reference
Community
GitHub DiscussionsStack Overflow
More
BlogGitHubStar
Facebook Open Source
Copyright © 2025 Michel Weststrate