mobx-keystone
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) • 814 B
TypeScript
import { ModelClass } from '../modelShared/BaseModelShared';
import { AnyType } from '../types/schemas';
import { AnyModel } from './BaseModel';
/**
* Associated model metadata.
*/
export interface ModelMetadata {
/**
* Associated data type for runtime checking (if any).
*/
dataType?: AnyType;
/**
* Property used as model id.
*/
modelIdProperty: string | undefined;
/**
* 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;