UNPKG

mobx-keystone-mindreframer

Version:

A MobX powered state management solution based on data trees with first class support for Typescript, snapshots, patches and much more

40 lines (39 loc) 1.25 kB
import type { AnyDataModel } from "../dataModel/BaseDataModel"; import type { AnyModel } from "../model/BaseModel"; /** * @ignore */ export declare const dataTypeSymbol: unique symbol; /** * @ignore */ export declare const creationDataTypeSymbol: unique symbol; /** * Extracts the instance type of a model class. */ export declare type ModelClass<M extends AnyModel | AnyDataModel> = { new (initialData: any): M; }; /** * Extracts the instance type of an abstract model class. */ export declare type AbstractModelClass<M extends AnyModel | AnyDataModel> = abstract new (initialData: any) => M; /** * The data type of a model. */ export declare type ModelData<M extends AnyModel | AnyDataModel> = M["$"]; /** * The creation data type of a model. */ export declare type ModelCreationData<M extends AnyModel> = M[typeof creationDataTypeSymbol]; /** * Tricks Typescript into accepting a particular kind of generic class as a parameter for `ExtendedModel`. * Does nothing in runtime. * * @typeparam T Generic model class type. * @param type Generic model class. * @returns */ export declare function modelClass<T extends AnyModel | AnyDataModel>(type: { prototype: T; }): ModelClass<T>;