id | title | sidebar_label |
---|---|---|
itype |
IType |
IType |
mobx-state-tree - v5.2.0 › IType
A type, either complex or simple.
▪ C
▪ S
▪ T
-
IType
↳ IAnyType
• identifierAttribute? : undefined | string
Defined in packages/mobx-state-tree/src/core/type/type.ts:89
Name of the identifier attribute or null if none.
• name: string
Defined in packages/mobx-state-tree/src/core/type/type.ts:84
Friendly type name.
▸ create(snapshot?
: C, env?
: any): this["Type"]
Defined in packages/mobx-state-tree/src/core/type/type.ts:96
Creates an instance for the type given an snapshot input.
Parameters:
Name | Type |
---|---|
snapshot? |
C |
env? |
any |
Returns: this["Type"]
An instance of that type.
▸ describe(): string
Defined in packages/mobx-state-tree/src/core/type/type.ts:118
Gets the textual representation of the type as a string.
Returns: string
▸ is(thing
: any): thing is C | this["Type"]
Defined in packages/mobx-state-tree/src/core/type/type.ts:104
Checks if a given snapshot / instance is of the given type.
Parameters:
Name | Type | Description |
---|---|---|
thing |
any | Snapshot or instance to be checked. |
Returns: thing is C | this["Type"]
true if the value is of the current type, false otherwise.
▸ validate(thing
: C, context
: IValidationContext): IValidationResult
Defined in packages/mobx-state-tree/src/core/type/type.ts:113
Run's the type's typechecker on the given value with the given validation context.
Parameters:
Name | Type | Description |
---|---|---|
thing |
C | Value to be checked, either a snapshot or an instance. |
context |
IValidationContext | Validation context, an array of { subpaths, subtypes } that should be validated |
Returns: IValidationResult
The validation result, an array with the list of validation errors.