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
28 lines (27 loc) • 890 B
TypeScript
import type { ModelClass } from "../modelShared/BaseModelShared";
import type { AnyType } from "../typeChecking/schemas";
import type { AnyModel } from "./BaseModel";
/**
* Associated model metadata.
*/
export interface ModelMetadata {
/**
* Associated data type for runtime checking (if any).
*/
dataType?: AnyType;
/**
* Property used as model id (usually `$modelId` unless overridden).
*/
modelIdProperty: string;
/**
* A value type will be cloned automatically when being attached to a new tree.
*/
valueType: boolean;
}
/**
* Returns the associated metadata for a model instance or class.
*
* @param modelClassOrInstance Model class or instance.
* @returns The associated metadata.
*/
export declare function getModelMetadata(modelClassOrInstance: AnyModel | ModelClass<AnyModel>): ModelMetadata;