mobx-state-tree > IAnyModelType
Any model type.
↳ IModelType<any
, any
, any
, any
>
↳ IAnyModelType
- actions
- create
- describe
- extend
- is
- named
- postProcessSnapshot
- preProcessSnapshot
- props
- validate
- views
- volatile
● name: string
Friendly type name.
● properties: any
▸ actions<A
>(fn: function
): IModelType<any
, any
& A
, any
, any
>
Type parameters:
Parameters:
Name | Type |
---|---|
fn | function |
Returns: IModelType<any
, any
& A
, any
, any
>
▸ create(...args: CreateParams
<ModelCreationType2
<any
, any
>>): STNValue
<ModelInstanceType
<any
, any
>, this
>
▸ create(snapshot: ModelCreationType2
<any
, any
>, env?: any
): STNValue
<ModelInstanceType
<any
, any
>, this
>
Parameters:
Name | Type |
---|---|
Rest args |
CreateParams <ModelCreationType2 <any , any >> |
Returns: STNValue
<ModelInstanceType
<any
, any
>, this
>
Creates an instance for the type given an snapshot input.
Parameters:
Name | Type |
---|---|
snapshot | ModelCreationType2 <any , any > |
Optional env |
any |
Returns: STNValue
<ModelInstanceType
<any
, any
>, this
>
An instance of that type.
▸ describe(): string
Gets the textual representation of the type as a string.
Returns: string
▸ extend<A
,V
,VS
>(fn: function
): IModelType<any
, any
& A
& V
& VS
, any
, any
>
Type parameters:
Parameters:
Name | Type |
---|---|
fn | function |
Returns: IModelType<any
, any
& A
& V
& VS
, any
, any
>
▸ is(thing: any
): boolean
Checks if a given snapshot / instance is of the given type.
Parameters:
Name | Type | Description |
---|---|---|
thing | any |
Snapshot or instance to be checked. |
Returns: boolean
true if the value is of the current type, false otherwise.
▸ named(newName: string
): IModelType<any
, any
, any
, any
>
Parameters:
Name | Type |
---|---|
newName | string |
Returns: IModelType<any
, any
, any
, any
>
▸ postProcessSnapshot<NewS
>(fn: function
): IModelType<any
, any
, any
, NewS
>
deprecated: See types.snapshotProcessor
Type parameters:
Parameters:
Name | Type |
---|---|
fn | function |
Returns: IModelType<any
, any
, any
, NewS
>
▸ preProcessSnapshot<NewC
>(fn: function
): IModelType<any
, any
, NewC
, any
>
deprecated: See types.snapshotProcessor
Type parameters:
Parameters:
Name | Type |
---|---|
fn | function |
Returns: IModelType<any
, any
, NewC
, any
>
▸ props<PROPS2
>(props: PROPS2
): IModelType<any
& ModelPropertiesDeclarationToProperties
<PROPS2
>, any
, any
, any
>
Type parameters:
Parameters:
Name | Type |
---|---|
props | PROPS2 |
Returns: IModelType<any
& ModelPropertiesDeclarationToProperties
<PROPS2
>, any
, any
, any
>
▸ validate(thing: ModelCreationType2
<any
, any
>, context: IValidationContext): IValidationResult
Run's the type's typechecker on the given value with the given validation context.
Parameters:
Name | Type | Description |
---|---|---|
thing | ModelCreationType2 <any , any > |
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.
▸ views<V
>(fn: function
): IModelType<any
, any
& V
, any
, any
>
Type parameters:
Parameters:
Name | Type |
---|---|
fn | function |
Returns: IModelType<any
, any
& V
, any
, any
>
▸ volatile<TP
>(fn: function
): IModelType<any
, any
& TP
, any
, any
>
Type parameters:
Parameters:
Name | Type |
---|---|
fn | function |
Returns: IModelType<any
, any
& TP
, any
, any
>