Skip to content

Latest commit

 

History

History
6711 lines (4044 loc) · 217 KB

index.md

File metadata and controls

6711 lines (4044 loc) · 217 KB
id title sidebar_label
index
mobx-state-tree - v5.4.1
Globals

mobx-state-tree - v5.4.1

Index

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

IDisposer

Ƭ IDisposer: function

Defined in src/utils.ts:41

A generic disposer.

Type declaration:

▸ (): void


IHooksGetter

Ƭ IHooksGetter: function

Defined in src/core/node/Hook.ts:19

Type declaration:

▸ (self: T): IHooks

Parameters:

Name Type
self T

IMiddlewareEventType

Ƭ IMiddlewareEventType: "action" | "flow_spawn" | "flow_resume" | "flow_resume_error" | "flow_return" | "flow_throw"

Defined in src/core/action.ts:16


IMiddlewareHandler

Ƭ IMiddlewareHandler: function

Defined in src/core/action.ts:54

Type declaration:

▸ (actionCall: IMiddlewareEvent, next: function, abort: function): any

Parameters:

actionCall: IMiddlewareEvent

next: function

▸ (actionCall: IMiddlewareEvent, callback?: undefined | function): void

Parameters:

Name Type
actionCall IMiddlewareEvent
callback? undefined | function

abort: function

▸ (value: any): void

Parameters:

Name Type
value any

ITypeDispatcher

Ƭ ITypeDispatcher: function

Defined in src/types/utility-types/union.ts:27

Type declaration:

▸ (snapshot: any): IAnyType

Parameters:

Name Type
snapshot any

IValidationContext

Ƭ IValidationContext: IValidationContextEntry[]

Defined in src/core/type/type-checker.ts:23

Array of validation context entries


IValidationResult

Ƭ IValidationResult: IValidationError[]

Defined in src/core/type/type-checker.ts:36

Type validation result, which is an array of type validation errors


Instance

Ƭ Instance: T extends object ? T["Type"] : T

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

The instance representation of a given type.


LivelinessMode

Ƭ LivelinessMode: "warn" | "error" | "ignore"

Defined in src/core/node/livelinessChecking.ts:7

Defines what MST should do when running into reads / writes to objects that have died.

  • "warn": Print a warning (default).
  • "error": Throw an exception.
  • "ignore": Do nothing.

OnReferenceInvalidated

Ƭ OnReferenceInvalidated: function

Defined in src/types/utility-types/reference.ts:43

Type declaration:

▸ (event: OnReferenceInvalidatedEvent‹STN›): void

Parameters:

Name Type
event OnReferenceInvalidatedEvent‹STN›

OnReferenceInvalidatedEvent

Ƭ OnReferenceInvalidatedEvent: object

Defined in src/types/utility-types/reference.ts:34

Type declaration:


ReferenceIdentifier

Ƭ ReferenceIdentifier: string | number

Defined in src/types/utility-types/identifier.ts:142

Valid types for identifiers.


ReferenceOptions

Ƭ ReferenceOptions: ReferenceOptionsGetSet‹IT› | ReferenceOptionsOnInvalidated‹IT› | ReferenceOptionsGetSet‹IT› & ReferenceOptionsOnInvalidated‹IT›

Defined in src/types/utility-types/reference.ts:451


SnapshotIn

Ƭ SnapshotIn: T extends object ? T["CreationType"] : T extends IStateTreeNode ? IT["CreationType"] : T

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

The input (creation) snapshot representation of a given type.


SnapshotOrInstance

Ƭ SnapshotOrInstance: SnapshotIn‹T› | Instance‹T›

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

A type which is equivalent to the union of SnapshotIn and Instance types of a given typeof TYPE or typeof VARIABLE. For primitives it defaults to the primitive itself.

For example:

  • SnapshotOrInstance<typeof ModelA> = SnapshotIn<typeof ModelA> | Instance<typeof ModelA>
  • SnapshotOrInstance<typeof self.a (where self.a is a ModelA)> = SnapshotIn<typeof ModelA> | Instance<typeof ModelA>

Usually you might want to use this when your model has a setter action that sets a property.

Example:

const ModelA = types.model({
  n: types.number
})

const ModelB = types.model({
  innerModel: ModelA
}).actions(self => ({
  // this will accept as property both the snapshot and the instance, whichever is preferred
  setInnerModel(m: SnapshotOrInstance<typeof self.innerModel>) {
    self.innerModel = cast(m)
  }
}))

SnapshotOut

Ƭ SnapshotOut: T extends object ? T["SnapshotType"] : T extends IStateTreeNode ? IT["SnapshotType"] : T

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

The output snapshot representation of a given type.

Variables

Const DatePrimitive

DatePrimitive: IType‹number | Date, number, Date› = _DatePrimitive

Defined in src/types/primitives.ts:215

types.Date - Creates a type that can only contain a javascript Date value.

Example:

const LogLine = types.model({
  timestamp: types.Date,
})

LogLine.create({ timestamp: new Date() })

Const boolean

boolean: ISimpleType‹boolean› = new CoreType<boolean, boolean, boolean>( "boolean", TypeFlags.Boolean, (v) => typeof v === "boolean" )

Defined in src/types/primitives.ts:169

types.boolean - Creates a type that can only contain a boolean value. This type is used for boolean values by default

Example:

const Thing = types.model({
  isCool: types.boolean,
  isAwesome: false
})

Const finite

finite: ISimpleType‹number› = new CoreType<number, number, number>( "finite", TypeFlags.Finite, (v) => isFinite(v) )

Defined in src/types/primitives.ts:150

types.finite - Creates a type that can only contain an finite value.

Example:

const Size = types.model({
  width: types.finite,
  height: 10
})

Const float

float: ISimpleType‹number› = new CoreType<number, number, number>( "float", TypeFlags.Float, (v) => isFloat(v) )

Defined in src/types/primitives.ts:132

types.float - Creates a type that can only contain an float value.

Example:

const Size = types.model({
  width: types.float,
  height: 10
})

Const identifier

identifier: ISimpleType‹string› = new IdentifierType()

Defined in src/types/utility-types/identifier.ts:110

types.identifier - Identifiers are used to make references, lifecycle events and reconciling works. Inside a state tree, for each type can exist only one instance for each given identifier. For example there couldn't be 2 instances of user with id 1. If you need more, consider using references. Identifier can be used only as type property of a model. This type accepts as parameter the value type of the identifier field that can be either string or number.

Example:

 const Todo = types.model("Todo", {
     id: types.identifier,
     title: types.string
 })

returns


Const identifierNumber

identifierNumber: ISimpleType‹number› = new IdentifierNumberType()

Defined in src/types/utility-types/identifier.ts:125

types.identifierNumber - Similar to types.identifier. This one will serialize from / to a number when applying snapshots

Example:

 const Todo = types.model("Todo", {
     id: types.identifierNumber,
     title: types.string
 })

returns


Const integer

integer: ISimpleType‹number› = new CoreType<number, number, number>( "integer", TypeFlags.Integer, (v) => isInteger(v) )

Defined in src/types/primitives.ts:114

types.integer - Creates a type that can only contain an integer value.

Example:

const Size = types.model({
  width: types.integer,
  height: 10
})

Const nullType

nullType: ISimpleType‹null› = new CoreType<null, null, null>( "null", TypeFlags.Null, (v) => v === null )

Defined in src/types/primitives.ts:178

types.null - The type of the value null


Const number

number: ISimpleType‹number› = new CoreType<number, number, number>( "number", TypeFlags.Number, (v) => typeof v === "number" )

Defined in src/types/primitives.ts:96

types.number - Creates a type that can only contain a numeric value. This type is used for numeric values by default

Example:

const Vector = types.model({
  x: types.number,
  y: 1.5
})

Const string

string: ISimpleType‹string› = new CoreType<string, string, string>( "string", TypeFlags.String, (v) => typeof v === "string" )

Defined in src/types/primitives.ts:77

types.string - Creates a type that can only contain a string value. This type is used for string values by default

Example:

const Person = types.model({
  firstName: types.string,
  lastName: "Doe"
})

Const undefinedType

undefinedType: ISimpleType‹undefined› = new CoreType<undefined, undefined, undefined>( "undefined", TypeFlags.Undefined, (v) => v === undefined )

Defined in src/types/primitives.ts:187

types.undefined - The type of the value undefined

Functions

addDisposer

addDisposer(target: IAnyStateTreeNode, disposer: IDisposer): IDisposer

Defined in src/core/mst-operations.ts:752

Use this utility to register a function that should be called whenever the targeted state tree node is destroyed. This is a useful alternative to managing cleanup methods yourself using the beforeDestroy hook.

This methods returns the same disposer that was passed as argument.

Example:

const Todo = types.model({
  title: types.string
}).actions(self => ({
  afterCreate() {
    const autoSaveDisposer = reaction(
      () => getSnapshot(self),
      snapshot => sendSnapshotToServerSomehow(snapshot)
    )
    // stop sending updates to server if this
    // instance is destroyed
    addDisposer(self, autoSaveDisposer)
  }
}))

Parameters:

Name Type
target IAnyStateTreeNode
disposer IDisposer

Returns: IDisposer

The same disposer that was passed as argument


addMiddleware

addMiddleware(target: IAnyStateTreeNode, handler: IMiddlewareHandler, includeHooks: boolean): IDisposer

Defined in src/core/action.ts:161

Middleware can be used to intercept any action is invoked on the subtree where it is attached. If a tree is protected (by default), this means that any mutation of the tree will pass through your middleware.

For more details, see the middleware docs

Parameters:

Name Type Default Description
target IAnyStateTreeNode - Node to apply the middleware to.
handler IMiddlewareHandler - -
includeHooks boolean true -

Returns: IDisposer

A callable function to dispose the middleware.


applyAction

applyAction(target: IAnyStateTreeNode, actions: ISerializedActionCall | ISerializedActionCall[]): void

Defined in src/middlewares/on-action.ts:88

Applies an action or a series of actions in a single MobX transaction. Does not return any value Takes an action description as produced by the onAction middleware.

Parameters:

Name Type Description
target IAnyStateTreeNode -
actions ISerializedActionCall | ISerializedActionCall[]

Returns: void


applyPatch

applyPatch(target: IAnyStateTreeNode, patch: IJsonPatch | ReadonlyArray‹IJsonPatch›): void

Defined in src/core/mst-operations.ts:125

Applies a JSON-patch to the given model instance or bails out if the patch couldn't be applied See patches for more details.

Can apply a single past, or an array of patches.

Parameters:

Name Type
target IAnyStateTreeNode
patch IJsonPatch | ReadonlyArray‹IJsonPatch

Returns: void


applySnapshot

applySnapshot<C>(target: IStateTreeNode‹IType‹C, any, any››, snapshot: C): void

Defined in src/core/mst-operations.ts:322

Applies a snapshot to a given model instances. Patch and snapshot listeners will be invoked as usual.

Type parameters:

C

Parameters:

Name Type
target IStateTreeNode‹IType‹C, any, any››
snapshot C

Returns: void


array

array<IT>(subtype: IT): IArrayType‹IT›

Defined in src/types/complex-types/array.ts:333

types.array - Creates an index based collection type who's children are all of a uniform declared type.

This type will always produce observable arrays

Example:

const Todo = types.model({
  task: types.string
})

const TodoStore = types.model({
  todos: types.array(Todo)
})

const s = TodoStore.create({ todos: [] })
unprotect(s) // needed to allow modifying outside of an action
s.todos.push({ task: "Grab coffee" })
console.log(s.todos[0]) // prints: "Grab coffee"

Type parameters:

IT: IAnyType

Parameters:

Name Type
subtype IT

Returns: IArrayType‹IT›


cast

cast<O>(snapshotOrInstance: O): O

Defined in src/core/mst-operations.ts:881

Casts a node snapshot or instance type to an instance type so it can be assigned to a type instance. Note that this is just a cast for the type system, this is, it won't actually convert a snapshot to an instance, but just fool typescript into thinking so. Either way, casting when outside an assignation operation won't compile.

Example:

const ModelA = types.model({
  n: types.number
}).actions(self => ({
  setN(aNumber: number) {
    self.n = aNumber
  }
}))

const ModelB = types.model({
  innerModel: ModelA
}).actions(self => ({
  someAction() {
    // this will allow the compiler to assign a snapshot to the property
    self.innerModel = cast({ a: 5 })
  }
}))

Type parameters:

O: string | number | boolean | null | undefined

Parameters:

Name Type Description
snapshotOrInstance O Snapshot or instance

Returns: O

The same object cast as an instance

cast<O>(snapshotOrInstance: TypeOfValue["CreationType"] | TypeOfValue["SnapshotType"] | TypeOfValue["Type"]): O

Defined in src/core/mst-operations.ts:884

Casts a node snapshot or instance type to an instance type so it can be assigned to a type instance. Note that this is just a cast for the type system, this is, it won't actually convert a snapshot to an instance, but just fool typescript into thinking so. Either way, casting when outside an assignation operation won't compile.

Example:

const ModelA = types.model({
  n: types.number
}).actions(self => ({
  setN(aNumber: number) {
    self.n = aNumber
  }
}))

const ModelB = types.model({
  innerModel: ModelA
}).actions(self => ({
  someAction() {
    // this will allow the compiler to assign a snapshot to the property
    self.innerModel = cast({ a: 5 })
  }
}))

Type parameters:

O

Parameters:

Name Type Description
snapshotOrInstance TypeOfValue["CreationType"] | TypeOfValue["SnapshotType"] | TypeOfValue["Type"] Snapshot or instance

Returns: O

The same object cast as an instance


castFlowReturn

castFlowReturn<T>(val: T): T

Defined in src/core/flow.ts:34

deprecated Not needed since TS3.6. Used for TypeScript to make flows that return a promise return the actual promise result.

Type parameters:

T

Parameters:

Name Type
val T

Returns: T


castToReferenceSnapshot

castToReferenceSnapshot<I>(instance: I): Extract<I, IAnyStateTreeNode> extends never ? I : ReferenceIdentifier

Defined in src/core/mst-operations.ts:984

Casts a node instance type to a reference snapshot type so it can be assigned to a reference snapshot (e.g. to be used inside a create call). Note that this is just a cast for the type system, this is, it won't actually convert an instance to a reference snapshot, but just fool typescript into thinking so.

Example:

const ModelA = types.model({
  id: types.identifier,
  n: types.number
}).actions(self => ({
  setN(aNumber: number) {
    self.n = aNumber
  }
}))

const ModelB = types.model({
  refA: types.reference(ModelA)
})

const a = ModelA.create({ id: 'someId', n: 5 });
// this will allow the compiler to use a model as if it were a reference snapshot
const b = ModelB.create({ refA: castToReferenceSnapshot(a)})

Type parameters:

I

Parameters:

Name Type Description
instance I Instance

Returns: Extract<I, IAnyStateTreeNode> extends never ? I : ReferenceIdentifier

The same object cast as a reference snapshot (string or number)


castToSnapshot

castToSnapshot<I>(snapshotOrInstance: I): Extract<I, IAnyStateTreeNode> extends never ? I : TypeOfValue["CreationType"]

Defined in src/core/mst-operations.ts:950

Casts a node instance type to a snapshot type so it can be assigned to a type snapshot (e.g. to be used inside a create call). Note that this is just a cast for the type system, this is, it won't actually convert an instance to a snapshot, but just fool typescript into thinking so.

Example:

const ModelA = types.model({
  n: types.number
}).actions(self => ({
  setN(aNumber: number) {
    self.n = aNumber
  }
}))

const ModelB = types.model({
  innerModel: ModelA
})

const a = ModelA.create({ n: 5 });
// this will allow the compiler to use a model as if it were a snapshot
const b = ModelB.create({ innerModel: castToSnapshot(a)})

Type parameters:

I

Parameters:

Name Type Description
snapshotOrInstance I Snapshot or instance

Returns: Extract<I, IAnyStateTreeNode> extends never ? I : TypeOfValue["CreationType"]

The same object cast as an input (creation) snapshot


clone

clone<T>(source: T, keepEnvironment: boolean | any): T

Defined in src/core/mst-operations.ts:667

Returns a deep copy of the given state tree node as new tree. Shorthand for snapshot(x) = getType(x).create(getSnapshot(x))

Tip: clone will create a literal copy, including the same identifiers. To modify identifiers etc. during cloning, don't use clone but take a snapshot of the tree, modify it, and create new instance

Type parameters:

T: IAnyStateTreeNode

Parameters:

Name Type Default Description
source T - -
keepEnvironment boolean | any true indicates whether the clone should inherit the same environment (true, the default), or not have an environment (false). If an object is passed in as second argument, that will act as the environment for the cloned tree.

Returns: T


compose

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB>(name: string, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›): IModelType‹PA & PB, OA & OB, _CustomJoin‹FCA, FCB›, _CustomJoin‹FSA, FSB››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

Parameters:

Name Type
name string
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›

Returns: IModelType‹PA & PB, OA & OB, _CustomJoin‹FCA, FCB›, _CustomJoin‹FSA, FSB››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›): IModelType‹PA & PB, OA & OB, _CustomJoin‹FCA, FCB›, _CustomJoin‹FSA, FSB››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›

Returns: IModelType‹PA & PB, OA & OB, _CustomJoin‹FCA, FCB›, _CustomJoin‹FSA, FSB››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC>(name: string, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›): IModelType‹PA & PB & PC, OA & OB & OC, _CustomJoin‹FCA, _CustomJoin‹FCB, FCC››, _CustomJoin‹FSA, _CustomJoin‹FSB, FSC›››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

Parameters:

Name Type
name string
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›

Returns: IModelType‹PA & PB & PC, OA & OB & OC, _CustomJoin‹FCA, _CustomJoin‹FCB, FCC››, _CustomJoin‹FSA, _CustomJoin‹FSB, FSC›››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›): IModelType‹PA & PB & PC, OA & OB & OC, _CustomJoin‹FCA, _CustomJoin‹FCB, FCC››, _CustomJoin‹FSA, _CustomJoin‹FSB, FSC›››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›

Returns: IModelType‹PA & PB & PC, OA & OB & OC, _CustomJoin‹FCA, _CustomJoin‹FCB, FCC››, _CustomJoin‹FSA, _CustomJoin‹FSB, FSC›››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD>(name: string, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›): IModelType‹PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, FCD›››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, FSD››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

Parameters:

Name Type
name string
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›

Returns: IModelType‹PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, FCD›››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, FSD››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›): IModelType‹PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, FCD›››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, FSD››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›

Returns: IModelType‹PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, FCD›››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, FSD››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE>(name: string, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›): IModelType‹PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, FCE››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, FSE›››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

Parameters:

Name Type
name string
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›

Returns: IModelType‹PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, FCE››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, FSE›››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›): IModelType‹PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, FCE››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, FSE›››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›

Returns: IModelType‹PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, FCE››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, FSE›››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF>(name: string, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›): IModelType‹PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, FCF›››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, FSF››››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

Parameters:

Name Type
name string
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›

Returns: IModelType‹PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, FCF›››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, FSF››››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›): IModelType‹PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, FCF›››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, FSF››››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›

Returns: IModelType‹PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, FCF›››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, FSF››››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG>(name: string, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›): IModelType‹PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, FCG››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, FSG›››››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

Parameters:

Name Type
name string
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›

Returns: IModelType‹PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, FCG››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, FSG›››››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›): IModelType‹PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, FCG››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, FSG›››››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›

Returns: IModelType‹PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, FCG››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, FSG›››››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG, PH, OH, FCH, FSH>(name: string, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›, H: IModelType‹PH, OH, FCH, FSH›): IModelType‹PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, _CustomJoin‹FCG, FCH›››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, _CustomJoin‹FSG, FSH››››››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

PH: ModelProperties

OH

FCH

FSH

Parameters:

Name Type
name string
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›
H IModelType‹PH, OH, FCH, FSH›

Returns: IModelType‹PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, _CustomJoin‹FCG, FCH›››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, _CustomJoin‹FSG, FSH››››››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG, PH, OH, FCH, FSH>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›, H: IModelType‹PH, OH, FCH, FSH›): IModelType‹PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, _CustomJoin‹FCG, FCH›››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, _CustomJoin‹FSG, FSH››››››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

PH: ModelProperties

OH

FCH

FSH

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›
H IModelType‹PH, OH, FCH, FSH›

Returns: IModelType‹PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, _CustomJoin‹FCG, FCH›››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, _CustomJoin‹FSG, FSH››››››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG, PH, OH, FCH, FSH, PI, OI, FCI, FSI>(name: string, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›, H: IModelType‹PH, OH, FCH, FSH›, I: IModelType‹PI, OI, FCI, FSI›): IModelType‹PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, _CustomJoin‹FCG, _CustomJoin‹FCH, FCI››››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, _CustomJoin‹FSG, _CustomJoin‹FSH, FSI›››››››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

PH: ModelProperties

OH

FCH

FSH

PI: ModelProperties

OI

FCI

FSI

Parameters:

Name Type
name string
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›
H IModelType‹PH, OH, FCH, FSH›
I IModelType‹PI, OI, FCI, FSI›

Returns: IModelType‹PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, _CustomJoin‹FCG, _CustomJoin‹FCH, FCI››››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, _CustomJoin‹FSG, _CustomJoin‹FSH, FSI›››››››››

compose<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG, PH, OH, FCH, FSH, PI, OI, FCI, FSI>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›, H: IModelType‹PH, OH, FCH, FSH›, I: IModelType‹PI, OI, FCI, FSI›): IModelType‹PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, _CustomJoin‹FCG, _CustomJoin‹FCH, FCI››››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, _CustomJoin‹FSG, _CustomJoin‹FSH, FSI›››››››››

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

types.compose - Composes a new model from one or more existing model types. This method can be invoked in two forms: Given 2 or more model types, the types are composed into a new Type. Given first parameter as a string and 2 or more model types, the types are composed into a new Type with the given name

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

PH: ModelProperties

OH

FCH

FSH

PI: ModelProperties

OI

FCI

FSI

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›
H IModelType‹PH, OH, FCH, FSH›
I IModelType‹PI, OI, FCI, FSI›

Returns: IModelType‹PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin‹FCA, _CustomJoin‹FCB, _CustomJoin‹FCC, _CustomJoin‹FCD, _CustomJoin‹FCE, _CustomJoin‹FCF, _CustomJoin‹FCG, _CustomJoin‹FCH, FCI››››››››, _CustomJoin‹FSA, _CustomJoin‹FSB, _CustomJoin‹FSC, _CustomJoin‹FSD, _CustomJoin‹FSE, _CustomJoin‹FSF, _CustomJoin‹FSG, _CustomJoin‹FSH, FSI›››››››››


createActionTrackingMiddleware

createActionTrackingMiddleware<T>(hooks: IActionTrackingMiddlewareHooks‹T›): IMiddlewareHandler

Defined in src/middlewares/create-action-tracking-middleware.ts:28

Note: Consider migrating to createActionTrackingMiddleware2, it is easier to use.

Convenience utility to create action based middleware that supports async processes more easily. All hooks are called for both synchronous and asynchronous actions. Except that either onSuccess or onFail is called

The create middleware tracks the process of an action (assuming it passes the filter). onResume can return any value, which will be passed as second argument to any other hook. This makes it possible to keep state during a process.

See the atomic middleware for an example

Type parameters:

T

Parameters:

Name Type
hooks IActionTrackingMiddlewareHooks‹T›

Returns: IMiddlewareHandler


createActionTrackingMiddleware2

createActionTrackingMiddleware2<TEnv>(middlewareHooks: IActionTrackingMiddleware2Hooks‹TEnv›): IMiddlewareHandler

Defined in src/middlewares/createActionTrackingMiddleware2.ts:74

Convenience utility to create action based middleware that supports async processes more easily. The flow is like this:

  • for each action: if filter passes -> onStart -> (inner actions recursively) -> onFinish

Example: if we had an action a that called inside an action b1, then b2 the flow would be:

  • filter(a)
  • onStart(a)
    • filter(b1)
    • onStart(b1)
    • onFinish(b1)
    • filter(b2)
    • onStart(b2)
    • onFinish(b2)
  • onFinish(a)

The flow is the same no matter if the actions are sync or async.

See the atomic middleware for an example

Type parameters:

TEnv

Parameters:

Name Type
middlewareHooks IActionTrackingMiddleware2Hooks‹TEnv›

Returns: IMiddlewareHandler


custom

custom<S, T>(options: CustomTypeOptions‹S, T›): IType‹S | T, S, T›

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

types.custom - Creates a custom type. Custom types can be used for arbitrary immutable values, that have a serializable representation. For example, to create your own Date representation, Decimal type etc.

The signature of the options is:

export interface CustomTypeOptions<S, T> {
    // Friendly name
    name: string
    // given a serialized value and environment, how to turn it into the target type
    fromSnapshot(snapshot: S, env: any): T
    // return the serialization of the current value
    toSnapshot(value: T): S
    // if true, this is a converted value, if false, it's a snapshot
    isTargetType(value: T | S): value is T
    // a non empty string is assumed to be a validation error
    getValidationMessage?(snapshot: S): string
}

Example:

const DecimalPrimitive = types.custom<string, Decimal>({
    name: "Decimal",
    fromSnapshot(value: string) {
        return new Decimal(value)
    },
    toSnapshot(value: Decimal) {
        return value.toString()
    },
    isTargetType(value: string | Decimal): boolean {
        return value instanceof Decimal
    },
    getValidationMessage(value: string): string {
        if (/^-?\d+\.\d+$/.test(value)) return "" // OK
        return `'${value}' doesn't look like a valid decimal number`
    }
})

const Wallet = types.model({
    balance: DecimalPrimitive
})

Type parameters:

S

T

Parameters:

Name Type
options CustomTypeOptions‹S, T›

Returns: IType‹S | T, S, T›


decorate

decorate<T>(handler: IMiddlewareHandler, fn: T, includeHooks: boolean): T

Defined in src/core/action.ts:200

Binds middleware to a specific action.

Example:

type.actions(self => {
  function takeA____() {
      self.toilet.donate()
      self.wipe()
      self.wipe()
      self.toilet.flush()
  }
  return {
    takeA____: decorate(atomic, takeA____)
  }
})

Type parameters:

T: Function

Parameters:

Name Type Default
handler IMiddlewareHandler -
fn T -
includeHooks boolean true

Returns: T

The original function


destroy

destroy(target: IAnyStateTreeNode): void

Defined in src/core/mst-operations.ts:699

Removes a model element from the state tree, and mark it as end-of-life; the element should not be used anymore

Parameters:

Name Type
target IAnyStateTreeNode

Returns: void


detach

detach<T>(target: T): T

Defined in src/core/mst-operations.ts:688

Removes a model element from the state tree, and let it live on as a new state tree

Type parameters:

T: IAnyStateTreeNode

Parameters:

Name Type
target T

Returns: T


enumeration

enumeration<T>(options: T): ISimpleType‹UnionStringArray‹T››

Defined in src/types/utility-types/enumeration.ts:11

types.enumeration - Can be used to create an string based enumeration. (note: this methods is just sugar for a union of string literals)

Example:

const TrafficLight = types.model({
  color: types.enumeration("Color", ["Red", "Orange", "Green"])
})

Type parameters:

T: keyof string[]

Parameters:

Name Type Description
options T possible values this enumeration can have

Returns: ISimpleType‹UnionStringArray‹T››

enumeration<T>(name: string, options: T[]): ISimpleType‹UnionStringArray‹T[]››

Defined in src/types/utility-types/enumeration.ts:14

types.enumeration - Can be used to create an string based enumeration. (note: this methods is just sugar for a union of string literals)

Example:

const TrafficLight = types.model({
  color: types.enumeration("Color", ["Red", "Orange", "Green"])
})

Type parameters:

T: string

Parameters:

Name Type Description
name string descriptive name of the enumeration (optional)
options T[] possible values this enumeration can have

Returns: ISimpleType‹UnionStringArray‹T[]››


escapeJsonPath

escapeJsonPath(path: string): string

Defined in src/core/json-patch.ts:77

Escape slashes and backslashes.

http://tools.ietf.org/html/rfc6901

Parameters:

Name Type
path string

Returns: string


flow

flow<R, Args>(generator: function): function

Defined in src/core/flow.ts:21

See asynchronous actions.

Type parameters:

R

Args: any[]

Parameters:

generator: function

▸ (...args: Args): Generator‹PromiseLike‹any›, R, any›

Parameters:

Name Type
...args Args

Returns: function

The flow as a promise.

▸ (...args: Args): Promise‹FlowReturn‹R››

Parameters:

Name Type
...args Args

frozen

frozen<C>(subType: IType‹C, any, any›): IType‹C, C, C›

Defined in src/types/utility-types/frozen.ts:54

types.frozen - Frozen can be used to store any value that is serializable in itself (that is valid JSON). Frozen values need to be immutable or treated as if immutable. They need be serializable as well. Values stored in frozen will snapshotted as-is by MST, and internal changes will not be tracked.

This is useful to store complex, but immutable values like vectors etc. It can form a powerful bridge to parts of your application that should be immutable, or that assume data to be immutable.

Note: if you want to store free-form state that is mutable, or not serializeable, consider using volatile state instead.

Frozen properties can be defined in three different ways

  1. types.frozen(SubType) - provide a valid MST type and frozen will check if the provided data conforms the snapshot for that type
  2. types.frozen({ someDefaultValue: true}) - provide a primitive value, object or array, and MST will infer the type from that object, and also make it the default value for the field
  3. types.frozen<TypeScriptType>() - provide a typescript type, to help in strongly typing the field (design time only)

Example:

const GameCharacter = types.model({
  name: string,
  location: types.frozen({ x: 0, y: 0})
})

const hero = GameCharacter.create({
  name: "Mario",
  location: { x: 7, y: 4 }
})

hero.location = { x: 10, y: 2 } // OK
hero.location.x = 7 // Not ok!
type Point = { x: number, y: number }
   const Mouse = types.model({
        loc: types.frozen<Point>()
   })

Type parameters:

C

Parameters:

Name Type
subType IType‹C, any, any›

Returns: IType‹C, C, C›

frozen<T>(defaultValue: T): IType‹T | undefined | null, T, T›

Defined in src/types/utility-types/frozen.ts:55

types.frozen - Frozen can be used to store any value that is serializable in itself (that is valid JSON). Frozen values need to be immutable or treated as if immutable. They need be serializable as well. Values stored in frozen will snapshotted as-is by MST, and internal changes will not be tracked.

This is useful to store complex, but immutable values like vectors etc. It can form a powerful bridge to parts of your application that should be immutable, or that assume data to be immutable.

Note: if you want to store free-form state that is mutable, or not serializeable, consider using volatile state instead.

Frozen properties can be defined in three different ways

  1. types.frozen(SubType) - provide a valid MST type and frozen will check if the provided data conforms the snapshot for that type
  2. types.frozen({ someDefaultValue: true}) - provide a primitive value, object or array, and MST will infer the type from that object, and also make it the default value for the field
  3. types.frozen<TypeScriptType>() - provide a typescript type, to help in strongly typing the field (design time only)

Example:

const GameCharacter = types.model({
  name: string,
  location: types.frozen({ x: 0, y: 0})
})

const hero = GameCharacter.create({
  name: "Mario",
  location: { x: 7, y: 4 }
})

hero.location = { x: 10, y: 2 } // OK
hero.location.x = 7 // Not ok!
type Point = { x: number, y: number }
   const Mouse = types.model({
        loc: types.frozen<Point>()
   })

Type parameters:

T

Parameters:

Name Type
defaultValue T

Returns: IType‹T | undefined | null, T, T›

frozen<T>(): IType‹T, T, T›

Defined in src/types/utility-types/frozen.ts:56

types.frozen - Frozen can be used to store any value that is serializable in itself (that is valid JSON). Frozen values need to be immutable or treated as if immutable. They need be serializable as well. Values stored in frozen will snapshotted as-is by MST, and internal changes will not be tracked.

This is useful to store complex, but immutable values like vectors etc. It can form a powerful bridge to parts of your application that should be immutable, or that assume data to be immutable.

Note: if you want to store free-form state that is mutable, or not serializeable, consider using volatile state instead.

Frozen properties can be defined in three different ways

  1. types.frozen(SubType) - provide a valid MST type and frozen will check if the provided data conforms the snapshot for that type
  2. types.frozen({ someDefaultValue: true}) - provide a primitive value, object or array, and MST will infer the type from that object, and also make it the default value for the field
  3. types.frozen<TypeScriptType>() - provide a typescript type, to help in strongly typing the field (design time only)

Example:

const GameCharacter = types.model({
  name: string,
  location: types.frozen({ x: 0, y: 0})
})

const hero = GameCharacter.create({
  name: "Mario",
  location: { x: 7, y: 4 }
})

hero.location = { x: 10, y: 2 } // OK
hero.location.x = 7 // Not ok!
type Point = { x: number, y: number }
   const Mouse = types.model({
        loc: types.frozen<Point>()
   })

Type parameters:

T

Returns: IType‹T, T, T›


getChildType

getChildType(object: IAnyStateTreeNode, propertyName?: undefined | string): IAnyType

Defined in src/core/mst-operations.ts:69

Returns the declared type of the given sub property of an object, array or map. In the case of arrays and maps the property name is optional and will be ignored.

Example:

const Box = types.model({ x: 0, y: 0 })
const box = Box.create()

console.log(getChildType(box, "x").name) // 'number'

Parameters:

Name Type
object IAnyStateTreeNode
propertyName? undefined | string

Returns: IAnyType


getEnv

getEnv<T>(target: IAnyStateTreeNode): T

Defined in src/core/mst-operations.ts:774

Returns the environment of the current state tree. For more info on environments, see Dependency injection

Please note that in child nodes access to the root is only possible once the afterAttach hook has fired

Returns an empty environment if the tree wasn't initialized with an environment

Type parameters:

T

Parameters:

Name Type
target IAnyStateTreeNode

Returns: T


getIdentifier

getIdentifier(target: IAnyStateTreeNode): string | null

Defined in src/core/mst-operations.ts:550

Returns the identifier of the target node. This is the string normalized identifier, which might not match the type of the identifier attribute

Parameters:

Name Type
target IAnyStateTreeNode

Returns: string | null


getLivelinessChecking

getLivelinessChecking(): LivelinessMode

Defined in src/core/node/livelinessChecking.ts:27

Returns the current liveliness checking mode.

Returns: LivelinessMode

"warn", "error" or "ignore"


getMembers

getMembers(target: IAnyStateTreeNode): IModelReflectionData

Defined in src/core/mst-operations.ts:853

Returns a reflection of the model node, including name, properties, views, volatile state, and actions. flowActions is also provided as a separate array of names for any action that came from a flow generator as well.

In the case where a model has two actions: doSomething and doSomethingWithFlow, where doSomethingWithFlow is a flow generator, the actions array will contain both actions, i.e. ["doSomething", "doSomethingWithFlow"], and the flowActions array will contain only the flow action, i.e. ["doSomethingWithFlow"].

Parameters:

Name Type
target IAnyStateTreeNode

Returns: IModelReflectionData


getNodeId

getNodeId(target: IAnyStateTreeNode): number

Defined in src/core/mst-operations.ts:999

Returns the unique node id (not to be confused with the instance identifier) for a given instance. This id is a number that is unique for each instance.

export

Parameters:

Name Type
target IAnyStateTreeNode

Returns: number


getParent

getParent<IT>(target: IAnyStateTreeNode, depth: number): TypeOrStateTreeNodeToStateTreeNode‹IT›

Defined in src/core/mst-operations.ts:383

Returns the immediate parent of this object, or throws.

Note that the immediate parent can be either an object, map or array, and doesn't necessarily refer to the parent model.

Please note that in child nodes access to the root is only possible once the afterAttach hook has fired.

Type parameters:

IT: IAnyStateTreeNode | IAnyComplexType

Parameters:

Name Type Default Description
target IAnyStateTreeNode - -
depth number 1 How far should we look upward? 1 by default.

Returns: TypeOrStateTreeNodeToStateTreeNode‹IT›


getParentOfType

getParentOfType<IT>(target: IAnyStateTreeNode, type: IT): IT["Type"]

Defined in src/core/mst-operations.ts:427

Returns the target's parent of a given type, or throws.

Type parameters:

IT: IAnyComplexType

Parameters:

Name Type
target IAnyStateTreeNode
type IT

Returns: IT["Type"]


getPath

getPath(target: IAnyStateTreeNode): string

Defined in src/core/mst-operations.ts:467

Returns the path of the given object in the model tree

Parameters:

Name Type
target IAnyStateTreeNode

Returns: string


getPathParts

getPathParts(target: IAnyStateTreeNode): string[]

Defined in src/core/mst-operations.ts:480

Returns the path of the given object as unescaped string array.

Parameters:

Name Type
target IAnyStateTreeNode

Returns: string[]


getPropertyMembers

getPropertyMembers(typeOrNode: IAnyModelType | IAnyStateTreeNode): IModelReflectionPropertiesData

Defined in src/core/mst-operations.ts:814

Returns a reflection of the model type properties and name for either a model type or model node.

Parameters:

Name Type
typeOrNode IAnyModelType | IAnyStateTreeNode

Returns: IModelReflectionPropertiesData


getRelativePath

getRelativePath(base: IAnyStateTreeNode, target: IAnyStateTreeNode): string

Defined in src/core/mst-operations.ts:649

Given two state tree nodes that are part of the same tree, returns the shortest jsonpath needed to navigate from the one to the other

Parameters:

Name Type
base IAnyStateTreeNode
target IAnyStateTreeNode

Returns: string


getRoot

getRoot<IT>(target: IAnyStateTreeNode): TypeOrStateTreeNodeToStateTreeNode‹IT›

Defined in src/core/mst-operations.ts:452

Given an object in a model tree, returns the root object of that tree.

Please note that in child nodes access to the root is only possible once the afterAttach hook has fired.

Type parameters:

IT: IAnyComplexType | IAnyStateTreeNode

Parameters:

Name Type
target IAnyStateTreeNode

Returns: TypeOrStateTreeNodeToStateTreeNode‹IT›


getRunningActionContext

getRunningActionContext(): IActionContext | undefined

Defined in src/core/actionContext.ts:26

Returns the currently executing MST action context, or undefined if none.

Returns: IActionContext | undefined


getSnapshot

getSnapshot<S>(target: IStateTreeNode‹IType‹any, S, any››, applyPostProcess: boolean): S

Defined in src/core/mst-operations.ts:337

Calculates a snapshot from the given model instance. The snapshot will always reflect the latest state but use structural sharing where possible. Doesn't require MobX transactions to be completed.

Type parameters:

S

Parameters:

Name Type Default Description
target IStateTreeNode‹IType‹any, S, any›› - -
applyPostProcess boolean true If true (the default) then postProcessSnapshot gets applied.

Returns: S


getType

getType(object: IAnyStateTreeNode): IAnyComplexType

Defined in src/core/mst-operations.ts:47

Returns the actual type of the given tree node. (Or throws)

Parameters:

Name Type
object IAnyStateTreeNode

Returns: IAnyComplexType


hasParent

hasParent(target: IAnyStateTreeNode, depth: number): boolean

Defined in src/core/mst-operations.ts:357

Given a model instance, returns true if the object has a parent, that is, is part of another object, map or array.

Parameters:

Name Type Default Description
target IAnyStateTreeNode - -
depth number 1 How far should we look upward? 1 by default.

Returns: boolean


hasParentOfType

hasParentOfType(target: IAnyStateTreeNode, type: IAnyComplexType): boolean

Defined in src/core/mst-operations.ts:407

Given a model instance, returns true if the object has a parent of given type, that is, is part of another object, map or array

Parameters:

Name Type
target IAnyStateTreeNode
type IAnyComplexType

Returns: boolean


isActionContextChildOf

isActionContextChildOf(actionContext: IActionContext, parent: number | IActionContext | IMiddlewareEvent): boolean

Defined in src/core/actionContext.ts:56

Returns if the given action context is a parent of this action context.

Parameters:

Name Type
actionContext IActionContext
parent number | IActionContext | IMiddlewareEvent

Returns: boolean


isActionContextThisOrChildOf

isActionContextThisOrChildOf(actionContext: IActionContext, parentOrThis: number | IActionContext | IMiddlewareEvent): boolean

Defined in src/core/actionContext.ts:66

Returns if the given action context is this or a parent of this action context.

Parameters:

Name Type
actionContext IActionContext
parentOrThis number | IActionContext | IMiddlewareEvent

Returns: boolean


isAlive

isAlive(target: IAnyStateTreeNode): boolean

Defined in src/core/mst-operations.ts:717

Returns true if the given state tree node is not killed yet. This means that the node is still a part of a tree, and that destroy has not been called. If a node is not alive anymore, the only thing one can do with it is requesting it's last path and snapshot

Parameters:

Name Type
target IAnyStateTreeNode

Returns: boolean


isArrayType

isArrayType<Items>(type: IAnyType): type is IArrayType

Defined in src/types/complex-types/array.ts:497

Returns if a given value represents an array type.

Type parameters:

Items: IAnyType

Parameters:

Name Type
type IAnyType

Returns: type is IArrayType

true if the type is an array type.


isFrozenType

isFrozenType<IT, T>(type: IT): type is IT

Defined in src/types/utility-types/frozen.ts:109

Returns if a given value represents a frozen type.

Type parameters:

IT: IType‹T | any, T, T›

T

Parameters:

Name Type
type IT

Returns: type is IT


isIdentifierType

isIdentifierType<IT>(type: IT): type is IT

Defined in src/types/utility-types/identifier.ts:133

Returns if a given value represents an identifier type.

Type parameters:

IT: ISimpleType | ISimpleType

Parameters:

Name Type
type IT

Returns: type is IT


isLateType

isLateType<IT>(type: IT): type is IT

Defined in src/types/utility-types/late.ts:137

Returns if a given value represents a late type.

Type parameters:

IT: IAnyType

Parameters:

Name Type
type IT

Returns: type is IT


isLiteralType

isLiteralType<IT>(type: IT): type is IT

Defined in src/types/utility-types/literal.ts:82

Returns if a given value represents a literal type.

Type parameters:

IT: ISimpleType‹any›

Parameters:

Name Type
type IT

Returns: type is IT


isMapType

isMapType<Items>(type: IAnyType): type is IMapType

Defined in src/types/complex-types/map.ts:512

Returns if a given value represents a map type.

Type parameters:

Items: IAnyType

Parameters:

Name Type
type IAnyType

Returns: type is IMapType

true if it is a map type.


isModelType

isModelType<IT>(type: IAnyType): type is IT

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

Returns if a given value represents a model type.

Type parameters:

IT: IAnyModelType

Parameters:

Name Type
type IAnyType

Returns: type is IT


isOptionalType

isOptionalType<IT>(type: IT): type is IT

Defined in src/types/utility-types/optional.ts:229

Returns if a value represents an optional type.

template IT

Type parameters:

IT: IAnyType

Parameters:

Name Type
type IT

Returns: type is IT


isPrimitiveType

isPrimitiveType<IT>(type: IT): type is IT

Defined in src/types/primitives.ts:241

Returns if a given value represents a primitive type.

Type parameters:

IT: ISimpleType‹string› | ISimpleType‹number› | ISimpleType‹boolean› | IType

Parameters:

Name Type
type IT

Returns: type is IT


isProtected

isProtected(target: IAnyStateTreeNode): boolean

Defined in src/core/mst-operations.ts:311

Returns true if the object is in protected mode, @see protect

Parameters:

Name Type
target IAnyStateTreeNode

Returns: boolean


isReferenceType

isReferenceType<IT>(type: IT): type is IT

Defined in src/types/utility-types/reference.ts:509

Returns if a given value represents a reference type.

Type parameters:

IT: IReferenceType‹any›

Parameters:

Name Type
type IT

Returns: type is IT


isRefinementType

isRefinementType<IT>(type: IT): type is IT

Defined in src/types/utility-types/refinement.ts:124

Returns if a given value is a refinement type.

Type parameters:

IT: IAnyType

Parameters:

Name Type
type IT

Returns: type is IT


isRoot

isRoot(target: IAnyStateTreeNode): boolean

Defined in src/core/mst-operations.ts:493

Returns true if the given object is the root of a model tree.

Parameters:

Name Type
target IAnyStateTreeNode

Returns: boolean


isStateTreeNode

isStateTreeNode<IT>(value: any): value is STNValue<Instance, IT>

Defined in src/core/node/node-utils.ts:68

Returns true if the given value is a node in a state tree. More precisely, that is, if the value is an instance of a types.model, types.array or types.map.

Type parameters:

IT: IAnyComplexType

Parameters:

Name Type
value any

Returns: value is STNValue<Instance, IT>

true if the value is a state tree node.


isType

isType(value: any): value is IAnyType

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

Returns if a given value represents a type.

Parameters:

Name Type Description
value any Value to check.

Returns: value is IAnyType

true if the value is a type.


isUnionType

isUnionType<IT>(type: IT): type is IT

Defined in src/types/utility-types/union.ts:280

Returns if a given value represents a union type.

Type parameters:

IT: IAnyType

Parameters:

Name Type
type IT

Returns: type is IT


isValidReference

isValidReference<N>(getter: function, checkIfAlive: boolean): boolean

Defined in src/core/mst-operations.ts:597

Tests if a reference is valid (pointing to an existing node and optionally if alive) and returns if the check passes or not.

Type parameters:

N: IAnyStateTreeNode

Parameters:

getter: function

Function to access the reference.

▸ (): N | null | undefined

Default value checkIfAlive: boolean= true

true to also make sure the referenced node is alive (default), false to skip this check.

Returns: boolean


joinJsonPath

joinJsonPath(path: string[]): string

Defined in src/core/json-patch.ts:98

Generates a json-path compliant json path from path parts.

Parameters:

Name Type
path string[]

Returns: string


late

late<T>(type: function): T

Defined in src/types/utility-types/late.ts:99

types.late - Defines a type that gets implemented later. This is useful when you have to deal with circular dependencies. Please notice that when defining circular dependencies TypeScript isn't smart enough to inference them.

Example:

  // TypeScript isn't smart enough to infer self referencing types.
 const Node = types.model({
      children: types.array(types.late((): IAnyModelType => Node)) // then typecast each array element to Instance<typeof Node>
 })

Type parameters:

T: IAnyType

Parameters:

type: function

A function that returns the type that will be defined.

▸ (): T

Returns: T

late<T>(name: string, type: function): T

Defined in src/types/utility-types/late.ts:100

types.late - Defines a type that gets implemented later. This is useful when you have to deal with circular dependencies. Please notice that when defining circular dependencies TypeScript isn't smart enough to inference them.

Example:

  // TypeScript isn't smart enough to infer self referencing types.
 const Node = types.model({
      children: types.array(types.late((): IAnyModelType => Node)) // then typecast each array element to Instance<typeof Node>
 })

Type parameters:

T: IAnyType

Parameters:

name: string

The name to use for the type that will be returned.

type: function

A function that returns the type that will be defined.

▸ (): T

Returns: T


lazy

lazy<T, U>(name: string, options: LazyOptions‹T, U›): T

Defined in src/types/utility-types/lazy.ts:22

Type parameters:

T: IType‹any, any, any›

U

Parameters:

Name Type
name string
options LazyOptions‹T, U›

Returns: T


literal

literal<S>(value: S): ISimpleType‹S›

Defined in src/types/utility-types/literal.ts:69

types.literal - The literal type will return a type that will match only the exact given type. The given value must be a primitive, in order to be serialized to a snapshot correctly. You can use literal to match exact strings for example the exact male or female string.

Example:

const Person = types.model({
    name: types.string,
    gender: types.union(types.literal('male'), types.literal('female'))
})

Type parameters:

S: Primitives

Parameters:

Name Type Description
value S The value to use in the strict equal check

Returns: ISimpleType‹S›


map

map<IT>(subtype: IT): IMapType‹IT›

Defined in src/types/complex-types/map.ts:502

types.map - Creates a key based collection type who's children are all of a uniform declared type. If the type stored in a map has an identifier, it is mandatory to store the child under that identifier in the map.

This type will always produce observable maps

Example:

const Todo = types.model({
  id: types.identifier,
  task: types.string
})

const TodoStore = types.model({
  todos: types.map(Todo)
})

const s = TodoStore.create({ todos: {} })
unprotect(s)
s.todos.set(17, { task: "Grab coffee", id: 17 })
s.todos.put({ task: "Grab cookie", id: 18 }) // put will infer key from the identifier
console.log(s.todos.get(17).task) // prints: "Grab coffee"

Type parameters:

IT: IAnyType

Parameters:

Name Type
subtype IT

Returns: IMapType‹IT›


maybe

maybe<IT>(type: IT): IMaybe‹IT›

Defined in src/types/utility-types/maybe.ts:31

types.maybe - Maybe will make a type nullable, and also optional. The value undefined will be used to represent nullability.

Type parameters:

IT: IAnyType

Parameters:

Name Type
type IT

Returns: IMaybe‹IT›


maybeNull

maybeNull<IT>(type: IT): IMaybeNull‹IT›

Defined in src/types/utility-types/maybe.ts:44

types.maybeNull - Maybe will make a type nullable, and also optional. The value null will be used to represent no value.

Type parameters:

IT: IAnyType

Parameters:

Name Type
type IT

Returns: IMaybeNull‹IT›


model

model<P>(name: string, properties?: P): IModelType‹ModelPropertiesDeclarationToProperties‹P›, __type›

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

types.model - Creates a new model type by providing a name, properties, volatile state and actions.

See the model type description or the getting started tutorial.

Type parameters:

P: ModelPropertiesDeclaration

Parameters:

Name Type
name string
properties? P

Returns: IModelType‹ModelPropertiesDeclarationToProperties‹P›, __type›

model<P>(properties?: P): IModelType‹ModelPropertiesDeclarationToProperties‹P›, __type›

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

types.model - Creates a new model type by providing a name, properties, volatile state and actions.

See the model type description or the getting started tutorial.

Type parameters:

P: ModelPropertiesDeclaration

Parameters:

Name Type
properties? P

Returns: IModelType‹ModelPropertiesDeclarationToProperties‹P›, __type›


onAction

onAction(target: IAnyStateTreeNode, listener: function, attachAfter: boolean): IDisposer

Defined in src/middlewares/on-action.ts:225

Registers a function that will be invoked for each action that is called on the provided model instance, or to any of its children. See actions for more details. onAction events are emitted only for the outermost called action in the stack. Action can also be intercepted by middleware using addMiddleware to change the function call before it will be run.

Not all action arguments might be serializable. For unserializable arguments, a struct like { $MST_UNSERIALIZABLE: true, type: "someType" } will be generated. MST Nodes are considered non-serializable as well (they could be serialized as there snapshot, but it is uncertain whether an replaying party will be able to handle such a non-instantiated snapshot). Rather, when using onAction middleware, one should consider in passing arguments which are 1: an id, 2: a (relative) path, or 3: a snapshot. Instead of a real MST node.

Example:

const Todo = types.model({
  task: types.string
})

const TodoStore = types.model({
  todos: types.array(Todo)
}).actions(self => ({
  add(todo) {
    self.todos.push(todo);
  }
}))

const s = TodoStore.create({ todos: [] })

let disposer = onAction(s, (call) => {
  console.log(call);
})

s.add({ task: "Grab a coffee" })
// Logs: { name: "add", path: "", args: [{ task: "Grab a coffee" }] }

Parameters:

target: IAnyStateTreeNode

listener: function

▸ (call: ISerializedActionCall): void

Parameters:

Name Type
call ISerializedActionCall

Default value attachAfter: boolean= false

(default false) fires the listener after the action has executed instead of before.

Returns: IDisposer


onPatch

onPatch(target: IAnyStateTreeNode, callback: function): IDisposer

Defined in src/core/mst-operations.ts:84

Registers a function that will be invoked for each mutation that is applied to the provided model instance, or to any of its children. See patches for more details. onPatch events are emitted immediately and will not await the end of a transaction. Patches can be used to deeply observe a model tree.

Parameters:

target: IAnyStateTreeNode

the model instance from which to receive patches

callback: function

the callback that is invoked for each patch. The reversePatch is a patch that would actually undo the emitted patch

▸ (patch: IJsonPatch, reversePatch: IJsonPatch): void

Parameters:

Name Type
patch IJsonPatch
reversePatch IJsonPatch

Returns: IDisposer

function to remove the listener


onSnapshot

onSnapshot<S>(target: IStateTreeNode‹IType‹any, S, any››, callback: function): IDisposer

Defined in src/core/mst-operations.ts:104

Registers a function that is invoked whenever a new snapshot for the given model instance is available. The listener will only be fire at the end of the current MobX (trans)action. See snapshots for more details.

Type parameters:

S

Parameters:

target: IStateTreeNode‹IType‹any, S, any››

callback: function

▸ (snapshot: S): void

Parameters:

Name Type
snapshot S

Returns: IDisposer


optional

optional<IT>(type: IT, defaultValueOrFunction: OptionalDefaultValueOrFunction‹IT›): IOptionalIType‹IT, [undefined]›

Defined in src/types/utility-types/optional.ts:155

types.optional - Can be used to create a property with a default value.

Depending on the third argument (optionalValues) there are two ways of operation:

  • If the argument is not provided, then if a value is not provided in the snapshot (undefined or missing), it will default to the provided defaultValue

  • If the argument is provided, then if the value in the snapshot matches one of the optional values inside the array then it will default to the provided defaultValue. Additionally, if one of the optional values inside the array is undefined then a missing property is also valid.

    Note that it is also possible to include values of the same type as the intended subtype as optional values, in this case the optional value will be transformed into the defaultValue (e.g. types.optional(types.string, "unnamed", [undefined, ""]) will transform the snapshot values undefined (and therefore missing) and empty strings into the string "unnamed" when it gets instantiated).

If defaultValue is a function, the function will be invoked for every new instance. Applying a snapshot in which the optional value is one of the optional values (or undefined/not present if none are provided) causes the value to be reset.

Example:

const Todo = types.model({
  title: types.string,
  subtitle1: types.optional(types.string, "", [null]),
  subtitle2: types.optional(types.string, "", [null, undefined]),
  done: types.optional(types.boolean, false),
  created: types.optional(types.Date, () => new Date()),
})

// if done is missing / undefined it will become false
// if created is missing / undefined it will get a freshly generated timestamp
// if subtitle1 is null it will default to "", but it cannot be missing or undefined
// if subtitle2 is null or undefined it will default to ""; since it can be undefined it can also be missing
const todo = Todo.create({ title: "Get coffee", subtitle1: null })

Type parameters:

IT: IAnyType

Parameters:

Name Type
type IT
defaultValueOrFunction OptionalDefaultValueOrFunction‹IT›

Returns: IOptionalIType‹IT, [undefined]›

optional<IT, OptionalVals>(type: IT, defaultValueOrFunction: OptionalDefaultValueOrFunction‹IT›, optionalValues: OptionalVals): IOptionalIType‹IT, OptionalVals›

Defined in src/types/utility-types/optional.ts:159

types.optional - Can be used to create a property with a default value.

Depending on the third argument (optionalValues) there are two ways of operation:

  • If the argument is not provided, then if a value is not provided in the snapshot (undefined or missing), it will default to the provided defaultValue

  • If the argument is provided, then if the value in the snapshot matches one of the optional values inside the array then it will default to the provided defaultValue. Additionally, if one of the optional values inside the array is undefined then a missing property is also valid.

    Note that it is also possible to include values of the same type as the intended subtype as optional values, in this case the optional value will be transformed into the defaultValue (e.g. types.optional(types.string, "unnamed", [undefined, ""]) will transform the snapshot values undefined (and therefore missing) and empty strings into the string "unnamed" when it gets instantiated).

If defaultValue is a function, the function will be invoked for every new instance. Applying a snapshot in which the optional value is one of the optional values (or undefined/not present if none are provided) causes the value to be reset.

Example:

const Todo = types.model({
  title: types.string,
  subtitle1: types.optional(types.string, "", [null]),
  subtitle2: types.optional(types.string, "", [null, undefined]),
  done: types.optional(types.boolean, false),
  created: types.optional(types.Date, () => new Date()),
})

// if done is missing / undefined it will become false
// if created is missing / undefined it will get a freshly generated timestamp
// if subtitle1 is null it will default to "", but it cannot be missing or undefined
// if subtitle2 is null or undefined it will default to ""; since it can be undefined it can also be missing
const todo = Todo.create({ title: "Get coffee", subtitle1: null })

Type parameters:

IT: IAnyType

OptionalVals: ValidOptionalValues

Parameters:

Name Type Description
type IT -
defaultValueOrFunction OptionalDefaultValueOrFunction‹IT› -
optionalValues OptionalVals an optional array with zero or more primitive values (string, number, boolean, null or undefined) that will be converted into the default. [ undefined ] is assumed when none is provided

Returns: IOptionalIType‹IT, OptionalVals›


protect

protect(target: IAnyStateTreeNode): void

Defined in src/core/mst-operations.ts:266

The inverse of unprotect.

Parameters:

Name Type Description
target IAnyStateTreeNode

Returns: void


recordActions

recordActions(subject: IAnyStateTreeNode, filter?: undefined | function): IActionRecorder

Defined in src/middlewares/on-action.ts:147

Small abstraction around onAction and applyAction, attaches an action listener to a tree and records all the actions emitted. Returns an recorder object with the following signature:

Example:

export interface IActionRecorder {
     // the recorded actions
     actions: ISerializedActionCall[]
     // true if currently recording
     recording: boolean
     // stop recording actions
     stop(): void
     // resume recording actions
     resume(): void
     // apply all the recorded actions on the given object
     replay(target: IAnyStateTreeNode): void
}

The optional filter function allows to skip recording certain actions.

Parameters:

Name Type
subject IAnyStateTreeNode
filter? undefined | function

Returns: IActionRecorder


recordPatches

recordPatches(subject: IAnyStateTreeNode, filter?: undefined | function): IPatchRecorder

Defined in src/core/mst-operations.ts:178

Small abstraction around onPatch and applyPatch, attaches a patch listener to a tree and records all the patches. Returns a recorder object with the following signature:

Example:

export interface IPatchRecorder {
     // the recorded patches
     patches: IJsonPatch[]
     // the inverse of the recorded patches
     inversePatches: IJsonPatch[]
     // true if currently recording
     recording: boolean
     // stop recording patches
     stop(): void
     // resume recording patches
     resume(): void
     // apply all the recorded patches on the given target (the original subject if omitted)
     replay(target?: IAnyStateTreeNode): void
     // reverse apply the recorded patches on the given target  (the original subject if omitted)
     // stops the recorder if not already stopped
     undo(): void
}

The optional filter function allows to skip recording certain patches.

Parameters:

Name Type
subject IAnyStateTreeNode
filter? undefined | function

Returns: IPatchRecorder


reference

reference<IT>(subType: IT, options?: ReferenceOptions‹IT›): IReferenceType‹IT›

Defined in src/types/utility-types/reference.ts:464

types.reference - Creates a reference to another type, which should have defined an identifier. See also the reference and identifiers section.

Type parameters:

IT: IAnyComplexType

Parameters:

Name Type
subType IT
options? ReferenceOptions‹IT›

Returns: IReferenceType‹IT›


refinement

refinement<IT>(name: string, type: IT, predicate: function, message?: string | function): IT

Defined in src/types/utility-types/refinement.ts:84

types.refinement - Creates a type that is more specific than the base type, e.g. types.refinement(types.string, value => value.length > 5) to create a type of strings that can only be longer then 5.

Type parameters:

IT: IAnyType

Parameters:

name: string

type: IT

predicate: function

▸ (snapshot: IT["CreationType"]): boolean

Parameters:

Name Type
snapshot IT["CreationType"]

Optional message: string | function

Returns: IT

refinement<IT>(type: IT, predicate: function, message?: string | function): IT

Defined in src/types/utility-types/refinement.ts:90

types.refinement - Creates a type that is more specific than the base type, e.g. types.refinement(types.string, value => value.length > 5) to create a type of strings that can only be longer then 5.

Type parameters:

IT: IAnyType

Parameters:

type: IT

predicate: function

▸ (snapshot: IT["CreationType"]): boolean

Parameters:

Name Type
snapshot IT["CreationType"]

Optional message: string | function

Returns: IT


resolveIdentifier

resolveIdentifier<IT>(type: IT, target: IAnyStateTreeNode, identifier: ReferenceIdentifier): IT["Type"] | undefined

Defined in src/core/mst-operations.ts:526

Resolves a model instance given a root target, the type and the identifier you are searching for. Returns undefined if no value can be found.

Type parameters:

IT: IAnyModelType

Parameters:

Name Type
type IT
target IAnyStateTreeNode
identifier ReferenceIdentifier

Returns: IT["Type"] | undefined


resolvePath

resolvePath(target: IAnyStateTreeNode, path: string): any

Defined in src/core/mst-operations.ts:508

Resolves a path relatively to a given object. Returns undefined if no value can be found.

Parameters:

Name Type Description
target IAnyStateTreeNode -
path string escaped json path

Returns: any


safeReference

safeReference<IT>(subType: IT, options: __type | ReferenceOptionsGetSet‹IT› & object): IReferenceType‹IT›

Defined in src/types/utility-types/reference.ts:513

types.safeReference - A safe reference is like a standard reference, except that it accepts the undefined value by default and automatically sets itself to undefined (when the parent is a model) / removes itself from arrays and maps when the reference it is pointing to gets detached/destroyed.

The optional options parameter object accepts a parameter named acceptsUndefined, which is set to true by default, so it is suitable for model properties. When used inside collections (arrays/maps), it is recommended to set this option to false so it can't take undefined as value, which is usually the desired in those cases. Additionally, the optional options parameter object accepts a parameter named onInvalidated, which will be called when the reference target node that the reference is pointing to is about to be detached/destroyed

Strictly speaking it is a types.maybe(types.reference(X)) (when acceptsUndefined is set to true, the default) and types.reference(X) (when acceptsUndefined is set to false), both of them with a customized onInvalidated option.

Type parameters:

IT: IAnyComplexType

Parameters:

Name Type
subType IT
options __type | ReferenceOptionsGetSet‹IT› & object

Returns: IReferenceType‹IT›

safeReference<IT>(subType: IT, options?: __type | ReferenceOptionsGetSet‹IT› & object): IMaybe‹IReferenceType‹IT››

Defined in src/types/utility-types/reference.ts:520

types.safeReference - A safe reference is like a standard reference, except that it accepts the undefined value by default and automatically sets itself to undefined (when the parent is a model) / removes itself from arrays and maps when the reference it is pointing to gets detached/destroyed.

The optional options parameter object accepts a parameter named acceptsUndefined, which is set to true by default, so it is suitable for model properties. When used inside collections (arrays/maps), it is recommended to set this option to false so it can't take undefined as value, which is usually the desired in those cases. Additionally, the optional options parameter object accepts a parameter named onInvalidated, which will be called when the reference target node that the reference is pointing to is about to be detached/destroyed

Strictly speaking it is a types.maybe(types.reference(X)) (when acceptsUndefined is set to true, the default) and types.reference(X) (when acceptsUndefined is set to false), both of them with a customized onInvalidated option.

Type parameters:

IT: IAnyComplexType

Parameters:

Name Type
subType IT
options? __type | ReferenceOptionsGetSet‹IT› & object

Returns: IMaybe‹IReferenceType‹IT››


setLivelinessChecking

setLivelinessChecking(mode: LivelinessMode): void

Defined in src/core/node/livelinessChecking.ts:18

Defines what MST should do when running into reads / writes to objects that have died. By default it will print a warning. Use the "error" option to easy debugging to see where the error was thrown and when the offending read / write took place

Parameters:

Name Type Description
mode LivelinessMode "warn", "error" or "ignore"

Returns: void


snapshotProcessor

snapshotProcessor<IT, CustomC, CustomS>(type: IT, processors: ISnapshotProcessors‹IT, CustomC, CustomS›, name?: undefined | string): ISnapshotProcessor‹IT, CustomC, CustomS›

Defined in src/types/utility-types/snapshotProcessor.ts:247

types.snapshotProcessor - Runs a pre/post snapshot processor before/after serializing a given type.

Example:

const Todo1 = types.model({ text: types.string })
// in the backend the text type must be null when empty
interface BackendTodo {
    text: string | null
}

const Todo2 = types.snapshotProcessor(Todo1, {
    // from snapshot to instance
    preProcessor(snapshot: BackendTodo) {
        return {
            text: sn.text || "";
        }
    },

    // from instance to snapshot
    postProcessor(snapshot, node): BackendTodo {
        return {
            text: !sn.text ? null : sn.text
        }
    }
})

Type parameters:

IT: IAnyType

CustomC

CustomS

Parameters:

Name Type Description
type IT Type to run the processors over.
processors ISnapshotProcessors‹IT, CustomC, CustomS› Processors to run.
name? undefined | string Type name, or undefined to inherit the inner type one.

Returns: ISnapshotProcessor‹IT, CustomC, CustomS›


splitJsonPath

splitJsonPath(path: string): string[]

Defined in src/core/json-patch.ts:118

Splits and decodes a json path into several parts.

Parameters:

Name Type
path string

Returns: string[]


toGenerator

toGenerator<R>(p: Promise‹R›): Generator‹Promise‹R›, R, R›

Defined in src/core/flow.ts:87

experimental experimental api - might change on minor/patch releases

Convert a promise to a generator yielding that promise This is intended to allow for usage of yield* in async actions to retain the promise return type.

Example:

function getDataAsync(input: string): Promise<number> { ... }

const someModel.actions(self => ({
  someAction: flow(function*() {
    // value is typed as number
    const value = yield* toGenerator(getDataAsync("input value"));
    ...
  })
}))

Type parameters:

R

Parameters:

Name Type
p Promise‹R›

Returns: Generator‹Promise‹R›, R, R›


toGeneratorFunction

toGeneratorFunction<R, Args>(p: function): (Anonymous function)

Defined in src/core/flow.ts:60

experimental experimental api - might change on minor/patch releases

Convert a promise-returning function to a generator-returning one. This is intended to allow for usage of yield* in async actions to retain the promise return type.

Example:

function getDataAsync(input: string): Promise<number> { ... }
const getDataGen = toGeneratorFunction(getDataAsync);

const someModel.actions(self => ({
  someAction: flow(function*() {
    // value is typed as number
    const value = yield* getDataGen("input value");
    ...
  })
}))

Type parameters:

R

Args: any[]

Parameters:

p: function

▸ (...args: Args): Promise‹R›

Parameters:

Name Type
...args Args

Returns: (Anonymous function)


tryReference

tryReference<N>(getter: function, checkIfAlive: boolean): N | undefined

Defined in src/core/mst-operations.ts:565

Tests if a reference is valid (pointing to an existing node and optionally if alive) and returns such reference if the check passes, else it returns undefined.

Type parameters:

N: IAnyStateTreeNode

Parameters:

getter: function

Function to access the reference.

▸ (): N | null | undefined

Default value checkIfAlive: boolean= true

true to also make sure the referenced node is alive (default), false to skip this check.

Returns: N | undefined


tryResolve

tryResolve(target: IAnyStateTreeNode, path: string): any

Defined in src/core/mst-operations.ts:625

Try to resolve a given path relative to a given node.

Parameters:

Name Type
target IAnyStateTreeNode
path string

Returns: any


typecheck

typecheck<IT>(type: IT, value: ExtractCSTWithSTN‹IT›): void

Defined in src/core/type/type-checker.ts:164

Run's the typechecker for the given type on the given value, which can be a snapshot or an instance. Throws if the given value is not according the provided type specification. Use this if you need typechecks even in a production build (by default all automatic runtime type checks will be skipped in production builds)

Type parameters:

IT: IAnyType

Parameters:

Name Type Description
type IT Type to check against.
value ExtractCSTWithSTN‹IT› Value to be checked, either a snapshot or an instance.

Returns: void


unescapeJsonPath

unescapeJsonPath(path: string): string

Defined in src/core/json-patch.ts:88

Unescape slashes and backslashes.

Parameters:

Name Type
path string

Returns: string


union

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB››

Defined in src/types/utility-types/union.ts:157

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB>(options: UnionOptions, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB››

Defined in src/types/utility-types/union.ts:159

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

Parameters:

Name Type
options UnionOptions
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC››

Defined in src/types/utility-types/union.ts:162

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC>(options: UnionOptions, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC››

Defined in src/types/utility-types/union.ts:164

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

Parameters:

Name Type
options UnionOptions
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD››

Defined in src/types/utility-types/union.ts:166

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD>(options: UnionOptions, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD››

Defined in src/types/utility-types/union.ts:169

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

Parameters:

Name Type
options UnionOptions
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE››

Defined in src/types/utility-types/union.ts:172

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE>(options: UnionOptions, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE››

Defined in src/types/utility-types/union.ts:175

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

Parameters:

Name Type
options UnionOptions
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF››

Defined in src/types/utility-types/union.ts:178

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF>(options: UnionOptions, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF››

Defined in src/types/utility-types/union.ts:181

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

Parameters:

Name Type
options UnionOptions
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG››

Defined in src/types/utility-types/union.ts:184

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG>(options: UnionOptions, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG››

Defined in src/types/utility-types/union.ts:187

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

Parameters:

Name Type
options UnionOptions
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG, PH, OH, FCH, FSH>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›, H: IModelType‹PH, OH, FCH, FSH›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG› | ModelCreationType2‹PH, FCH›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG› | ModelSnapshotType2‹PH, FSH›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG› | ModelInstanceType‹PH, OH››

Defined in src/types/utility-types/union.ts:191

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

PH: ModelProperties

OH

FCH

FSH

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›
H IModelType‹PH, OH, FCH, FSH›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG› | ModelCreationType2‹PH, FCH›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG› | ModelSnapshotType2‹PH, FSH›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG› | ModelInstanceType‹PH, OH››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG, PH, OH, FCH, FSH>(options: UnionOptions, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›, H: IModelType‹PH, OH, FCH, FSH›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG› | ModelCreationType2‹PH, FCH›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG› | ModelSnapshotType2‹PH, FSH›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG› | ModelInstanceType‹PH, OH››

Defined in src/types/utility-types/union.ts:194

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

PH: ModelProperties

OH

FCH

FSH

Parameters:

Name Type
options UnionOptions
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›
H IModelType‹PH, OH, FCH, FSH›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG› | ModelCreationType2‹PH, FCH›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG› | ModelSnapshotType2‹PH, FSH›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG› | ModelInstanceType‹PH, OH››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG, PH, OH, FCH, FSH, PI, OI, FCI, FSI>(A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›, H: IModelType‹PH, OH, FCH, FSH›, I: IModelType‹PI, OI, FCI, FSI›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG› | ModelCreationType2‹PH, FCH› | ModelCreationType2‹PI, FCI›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG› | ModelSnapshotType2‹PH, FSH› | ModelSnapshotType2‹PI, FSI›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG› | ModelInstanceType‹PH, OH› | ModelInstanceType‹PI, OI››

Defined in src/types/utility-types/union.ts:198

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

PH: ModelProperties

OH

FCH

FSH

PI: ModelProperties

OI

FCI

FSI

Parameters:

Name Type
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›
H IModelType‹PH, OH, FCH, FSH›
I IModelType‹PI, OI, FCI, FSI›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG› | ModelCreationType2‹PH, FCH› | ModelCreationType2‹PI, FCI›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG› | ModelSnapshotType2‹PH, FSH› | ModelSnapshotType2‹PI, FSI›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG› | ModelInstanceType‹PH, OH› | ModelInstanceType‹PI, OI››

union<PA, OA, FCA, FSA, PB, OB, FCB, FSB, PC, OC, FCC, FSC, PD, OD, FCD, FSD, PE, OE, FCE, FSE, PF, OF, FCF, FSF, PG, OG, FCG, FSG, PH, OH, FCH, FSH, PI, OI, FCI, FSI>(options: UnionOptions, A: IModelType‹PA, OA, FCA, FSA›, B: IModelType‹PB, OB, FCB, FSB›, C: IModelType‹PC, OC, FCC, FSC›, D: IModelType‹PD, OD, FCD, FSD›, E: IModelType‹PE, OE, FCE, FSE›, F: IModelType‹PF, OF, FCF, FSF›, G: IModelType‹PG, OG, FCG, FSG›, H: IModelType‹PH, OH, FCH, FSH›, I: IModelType‹PI, OI, FCI, FSI›): ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG› | ModelCreationType2‹PH, FCH› | ModelCreationType2‹PI, FCI›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG› | ModelSnapshotType2‹PH, FSH› | ModelSnapshotType2‹PI, FSI›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG› | ModelInstanceType‹PH, OH› | ModelInstanceType‹PI, OI››

Defined in src/types/utility-types/union.ts:201

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

PA: ModelProperties

OA

FCA

FSA

PB: ModelProperties

OB

FCB

FSB

PC: ModelProperties

OC

FCC

FSC

PD: ModelProperties

OD

FCD

FSD

PE: ModelProperties

OE

FCE

FSE

PF: ModelProperties

OF

FCF

FSF

PG: ModelProperties

OG

FCG

FSG

PH: ModelProperties

OH

FCH

FSH

PI: ModelProperties

OI

FCI

FSI

Parameters:

Name Type
options UnionOptions
A IModelType‹PA, OA, FCA, FSA›
B IModelType‹PB, OB, FCB, FSB›
C IModelType‹PC, OC, FCC, FSC›
D IModelType‹PD, OD, FCD, FSD›
E IModelType‹PE, OE, FCE, FSE›
F IModelType‹PF, OF, FCF, FSF›
G IModelType‹PG, OG, FCG, FSG›
H IModelType‹PH, OH, FCH, FSH›
I IModelType‹PI, OI, FCI, FSI›

Returns: ITypeUnion‹ModelCreationType2‹PA, FCA› | ModelCreationType2‹PB, FCB› | ModelCreationType2‹PC, FCC› | ModelCreationType2‹PD, FCD› | ModelCreationType2‹PE, FCE› | ModelCreationType2‹PF, FCF› | ModelCreationType2‹PG, FCG› | ModelCreationType2‹PH, FCH› | ModelCreationType2‹PI, FCI›, ModelSnapshotType2‹PA, FSA› | ModelSnapshotType2‹PB, FSB› | ModelSnapshotType2‹PC, FSC› | ModelSnapshotType2‹PD, FSD› | ModelSnapshotType2‹PE, FSE› | ModelSnapshotType2‹PF, FSF› | ModelSnapshotType2‹PG, FSG› | ModelSnapshotType2‹PH, FSH› | ModelSnapshotType2‹PI, FSI›, ModelInstanceType‹PA, OA› | ModelInstanceType‹PB, OB› | ModelInstanceType‹PC, OC› | ModelInstanceType‹PD, OD› | ModelInstanceType‹PE, OE› | ModelInstanceType‹PF, OF› | ModelInstanceType‹PG, OG› | ModelInstanceType‹PH, OH› | ModelInstanceType‹PI, OI››

union<CA, SA, TA, CB, SB, TB>(A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›): ITypeUnion‹CA | CB, SA | SB, TA | TB›

Defined in src/types/utility-types/union.ts:205

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

Parameters:

Name Type
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›

Returns: ITypeUnion‹CA | CB, SA | SB, TA | TB›

union<CA, SA, TA, CB, SB, TB>(options: UnionOptions, A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›): ITypeUnion‹CA | CB, SA | SB, TA | TB›

Defined in src/types/utility-types/union.ts:207

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

Parameters:

Name Type
options UnionOptions
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›

Returns: ITypeUnion‹CA | CB, SA | SB, TA | TB›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC>(A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›): ITypeUnion‹CA | CB | CC, SA | SB | SC, TA | TB | TC›

Defined in src/types/utility-types/union.ts:209

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

Parameters:

Name Type
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›

Returns: ITypeUnion‹CA | CB | CC, SA | SB | SC, TA | TB | TC›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC>(options: UnionOptions, A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›): ITypeUnion‹CA | CB | CC, SA | SB | SC, TA | TB | TC›

Defined in src/types/utility-types/union.ts:211

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

Parameters:

Name Type
options UnionOptions
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›

Returns: ITypeUnion‹CA | CB | CC, SA | SB | SC, TA | TB | TC›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD>(A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›): ITypeUnion‹CA | CB | CC | CD, SA | SB | SC | SD, TA | TB | TC | TD›

Defined in src/types/utility-types/union.ts:213

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

Parameters:

Name Type
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›

Returns: ITypeUnion‹CA | CB | CC | CD, SA | SB | SC | SD, TA | TB | TC | TD›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD>(options: UnionOptions, A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›): ITypeUnion‹CA | CB | CC | CD, SA | SB | SC | SD, TA | TB | TC | TD›

Defined in src/types/utility-types/union.ts:216

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

Parameters:

Name Type
options UnionOptions
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›

Returns: ITypeUnion‹CA | CB | CC | CD, SA | SB | SC | SD, TA | TB | TC | TD›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE>(A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›): ITypeUnion‹CA | CB | CC | CD | CE, SA | SB | SC | SD | SE, TA | TB | TC | TD | TE›

Defined in src/types/utility-types/union.ts:218

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

Parameters:

Name Type
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›

Returns: ITypeUnion‹CA | CB | CC | CD | CE, SA | SB | SC | SD | SE, TA | TB | TC | TD | TE›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE>(options: UnionOptions, A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›): ITypeUnion‹CA | CB | CC | CD | CE, SA | SB | SC | SD | SE, TA | TB | TC | TD | TE›

Defined in src/types/utility-types/union.ts:220

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

Parameters:

Name Type
options UnionOptions
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›

Returns: ITypeUnion‹CA | CB | CC | CD | CE, SA | SB | SC | SD | SE, TA | TB | TC | TD | TE›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF>(A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›, F: IType‹CF, SF, TF›): ITypeUnion‹CA | CB | CC | CD | CE | CF, SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF›

Defined in src/types/utility-types/union.ts:222

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

CF

SF

TF

Parameters:

Name Type
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›
F IType‹CF, SF, TF›

Returns: ITypeUnion‹CA | CB | CC | CD | CE | CF, SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF>(options: UnionOptions, A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›, F: IType‹CF, SF, TF›): ITypeUnion‹CA | CB | CC | CD | CE | CF, SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF›

Defined in src/types/utility-types/union.ts:224

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

CF

SF

TF

Parameters:

Name Type
options UnionOptions
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›
F IType‹CF, SF, TF›

Returns: ITypeUnion‹CA | CB | CC | CD | CE | CF, SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG>(A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›, F: IType‹CF, SF, TF›, G: IType‹CG, SG, TG›): ITypeUnion‹CA | CB | CC | CD | CE | CF | CG, SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG›

Defined in src/types/utility-types/union.ts:226

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

CF

SF

TF

CG

SG

TG

Parameters:

Name Type
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›
F IType‹CF, SF, TF›
G IType‹CG, SG, TG›

Returns: ITypeUnion‹CA | CB | CC | CD | CE | CF | CG, SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG>(options: UnionOptions, A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›, F: IType‹CF, SF, TF›, G: IType‹CG, SG, TG›): ITypeUnion‹CA | CB | CC | CD | CE | CF | CG, SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG›

Defined in src/types/utility-types/union.ts:229

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

CF

SF

TF

CG

SG

TG

Parameters:

Name Type
options UnionOptions
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›
F IType‹CF, SF, TF›
G IType‹CG, SG, TG›

Returns: ITypeUnion‹CA | CB | CC | CD | CE | CF | CG, SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG, CH, SH, TH>(A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›, F: IType‹CF, SF, TF›, G: IType‹CG, SG, TG›, H: IType‹CH, SH, TH›): ITypeUnion‹CA | CB | CC | CD | CE | CF | CG | CH, SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH›

Defined in src/types/utility-types/union.ts:231

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

CF

SF

TF

CG

SG

TG

CH

SH

TH

Parameters:

Name Type
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›
F IType‹CF, SF, TF›
G IType‹CG, SG, TG›
H IType‹CH, SH, TH›

Returns: ITypeUnion‹CA | CB | CC | CD | CE | CF | CG | CH, SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG, CH, SH, TH>(options: UnionOptions, A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›, F: IType‹CF, SF, TF›, G: IType‹CG, SG, TG›, H: IType‹CH, SH, TH›): ITypeUnion‹CA | CB | CC | CD | CE | CF | CG | CH, SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH›

Defined in src/types/utility-types/union.ts:234

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

CF

SF

TF

CG

SG

TG

CH

SH

TH

Parameters:

Name Type
options UnionOptions
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›
F IType‹CF, SF, TF›
G IType‹CG, SG, TG›
H IType‹CH, SH, TH›

Returns: ITypeUnion‹CA | CB | CC | CD | CE | CF | CG | CH, SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG, CH, SH, TH, CI, SI, TI>(A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›, F: IType‹CF, SF, TF›, G: IType‹CG, SG, TG›, H: IType‹CH, SH, TH›, I: IType‹CI, SI, TI›): ITypeUnion‹CA | CB | CC | CD | CE | CF | CG | CH | CI, SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI›

Defined in src/types/utility-types/union.ts:237

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

CF

SF

TF

CG

SG

TG

CH

SH

TH

CI

SI

TI

Parameters:

Name Type
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›
F IType‹CF, SF, TF›
G IType‹CG, SG, TG›
H IType‹CH, SH, TH›
I IType‹CI, SI, TI›

Returns: ITypeUnion‹CA | CB | CC | CD | CE | CF | CG | CH | CI, SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI›

union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG, CH, SH, TH, CI, SI, TI>(options: UnionOptions, A: IType‹CA, SA, TA›, B: IType‹CB, SB, TB›, C: IType‹CC, SC, TC›, D: IType‹CD, SD, TD›, E: IType‹CE, SE, TE›, F: IType‹CF, SF, TF›, G: IType‹CG, SG, TG›, H: IType‹CH, SH, TH›, I: IType‹CI, SI, TI›): ITypeUnion‹CA | CB | CC | CD | CE | CF | CG | CH | CI, SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI›

Defined in src/types/utility-types/union.ts:240

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Type parameters:

CA

SA

TA

CB

SB

TB

CC

SC

TC

CD

SD

TD

CE

SE

TE

CF

SF

TF

CG

SG

TG

CH

SH

TH

CI

SI

TI

Parameters:

Name Type
options UnionOptions
A IType‹CA, SA, TA›
B IType‹CB, SB, TB›
C IType‹CC, SC, TC›
D IType‹CD, SD, TD›
E IType‹CE, SE, TE›
F IType‹CF, SF, TF›
G IType‹CG, SG, TG›
H IType‹CH, SH, TH›
I IType‹CI, SI, TI›

Returns: ITypeUnion‹CA | CB | CC | CD | CE | CF | CG | CH | CI, SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI›

union(...types: IAnyType[]): IAnyType

Defined in src/types/utility-types/union.ts:243

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Parameters:

Name Type
...types IAnyType[]

Returns: IAnyType

union(dispatchOrType: UnionOptions | IAnyType, ...otherTypes: IAnyType[]): IAnyType

Defined in src/types/utility-types/union.ts:244

types.union - Create a union of multiple types. If the correct type cannot be inferred unambiguously from a snapshot, provide a dispatcher function of the form (snapshot) => Type.

Parameters:

Name Type
dispatchOrType UnionOptions | IAnyType
...otherTypes IAnyType[]

Returns: IAnyType


unprotect

unprotect(target: IAnyStateTreeNode): void

Defined in src/core/mst-operations.ts:299

By default it is not allowed to directly modify a model. Models can only be modified through actions. However, in some cases you don't care about the advantages (like replayability, traceability, etc) this yields. For example because you are building a PoC or don't have any middleware attached to your tree.

In that case you can disable this protection by calling unprotect on the root of your tree.

Example:

const Todo = types.model({
    done: false
}).actions(self => ({
    toggle() {
        self.done = !self.done
    }
}))

const todo = Todo.create()
todo.done = true // throws!
todo.toggle() // OK
unprotect(todo)
todo.done = false // OK

Parameters:

Name Type
target IAnyStateTreeNode

Returns: void


walk

walk(target: IAnyStateTreeNode, processor: function): void

Defined in src/core/mst-operations.ts:787

Performs a depth first walk through a tree.

Parameters:

target: IAnyStateTreeNode

processor: function

▸ (item: IAnyStateTreeNode): void

Parameters:

Name Type
item IAnyStateTreeNode

Returns: void

Object literals

Const types

types: object

Defined in src/types/index.ts:34

Date

Date: IType‹number | Date, number, Date› = DatePrimitive

Defined in src/types/index.ts:53

array

array: array

Defined in src/types/index.ts:55

boolean

boolean: ISimpleType‹boolean›

Defined in src/types/index.ts:48

compose

compose: compose

Defined in src/types/index.ts:37

custom

custom: custom

Defined in src/types/index.ts:38

enumeration

enumeration: enumeration

Defined in src/types/index.ts:35

finite

finite: ISimpleType‹number›

Defined in src/types/index.ts:52

float

float: ISimpleType‹number›

Defined in src/types/index.ts:51

frozen

frozen: frozen

Defined in src/types/index.ts:56

identifier

identifier: ISimpleType‹string›

Defined in src/types/index.ts:57

identifierNumber

identifierNumber: ISimpleType‹number›

Defined in src/types/index.ts:58

integer

integer: ISimpleType‹number›

Defined in src/types/index.ts:50

late

late: late

Defined in src/types/index.ts:59

lazy

lazy: lazy

Defined in src/types/index.ts:60

literal

literal: literal

Defined in src/types/index.ts:43

map

map: map

Defined in src/types/index.ts:54

maybe

maybe: maybe

Defined in src/types/index.ts:44

maybeNull

maybeNull: maybeNull

Defined in src/types/index.ts:45

model

model: model

Defined in src/types/index.ts:36

null

null: ISimpleType‹null› = nullType

Defined in src/types/index.ts:62

number

number: ISimpleType‹number›

Defined in src/types/index.ts:49

optional

optional: optional

Defined in src/types/index.ts:42

reference

reference: reference

Defined in src/types/index.ts:39

refinement

refinement: refinement

Defined in src/types/index.ts:46

safeReference

safeReference: safeReference

Defined in src/types/index.ts:40

snapshotProcessor

snapshotProcessor: snapshotProcessor

Defined in src/types/index.ts:63

string

string: ISimpleType‹string›

Defined in src/types/index.ts:47

undefined

undefined: ISimpleType‹undefined› = undefinedType

Defined in src/types/index.ts:61

union

union: union

Defined in src/types/index.ts:41