Skip to main content

Interface: AnyModel

Any kind of model instance.

Extends​

Properties​

[fromSnapshotOverrideTypeSymbol]​

[fromSnapshotOverrideTypeSymbol]: any;

Inherited from​

BaseModel.[fromSnapshotOverrideTypeSymbol]


[modelIdPropertyNameSymbol]​

[modelIdPropertyNameSymbol]: any;

Inherited from​

BaseModel.[modelIdPropertyNameSymbol]


[propsTypeSymbol]​

[propsTypeSymbol]: any;

Inherited from​

BaseModel.[propsTypeSymbol]


[toSnapshotOverrideTypeSymbol]​

[toSnapshotOverrideTypeSymbol]: any;

Inherited from​

BaseModel.[toSnapshotOverrideTypeSymbol]


$​

readonly $: object;

Data part of the model, which is observable and will be serialized in snapshots. Use it if one of the data properties matches one of the model properties/functions.

Index Signature​

[key: string]: any

Inherited from​

BaseModel.$


$modelType​

readonly $modelType: string;

Model type name.

Inherited from​

BaseModel.$modelType

Accessors​

$modelId​

Get Signature​

get $modelId(): ModelIdPropertyType<TProps, ModelIdPropertyName>;

Model internal id. Can be modified inside a model action. It will return undefined if there's no id prop set.

Returns​

ModelIdPropertyType<TProps, ModelIdPropertyName>

Set Signature​

set $modelId(newId): void;
Parameters​
ParameterType
newIdModelIdPropertyType<TProps, ModelIdPropertyName>
Returns​

void

Inherited from​

BaseModel.$modelId

Methods​

getRefId()​

getRefId(): string | undefined;

Can be overridden to offer a reference id to be used in reference resolution. By default it will use the idProp if available or return undefined otherwise.

Returns​

string | undefined

Inherited from​

BaseModel.getRefId


toString()​

toString(options?): string;

Parameters​

ParameterType
options?{ withData?: boolean; }
options.withData?boolean

Returns​

string

Inherited from​

BaseModel.toString


typeCheck()​

typeCheck(): TypeCheckError | null;

Performs a type check over the model instance. For this to work a data type has to be declared as part of the model properties.

Returns​

TypeCheckError | null

A TypeCheckError or null if there is no error.

Inherited from​

BaseModel.typeCheck