mobx-keystone
Version:
A MobX powered state management solution based on data trees with first class support for TypeScript, snapshots, patches and much more
52 lines (51 loc) • 1.38 kB
TypeScript
/**
* Model auto type-checking mode.
*/
export declare enum ModelAutoTypeCheckingMode {
/**
* Auto type check models only in dev mode
*/
DevModeOnly = "devModeOnly",
/**
* Auto type check models no matter the current environment
*/
AlwaysOn = "alwaysOn",
/**
* Do not auto type check models no matter the current environment
*/
AlwaysOff = "alwaysOff"
}
/**
* Global config object.
*/
export interface GlobalConfig {
/**
* Model auto type-checking mode.
*/
modelAutoTypeChecking: ModelAutoTypeCheckingMode;
/**
* ID generator function for model ids.
*/
modelIdGenerator(): string;
/**
* Allow array elements to be `undefined`.
*/
allowUndefinedArrayElements: boolean;
/**
* Enables/disables warnings related to duplicated model names (defaults to `true`).
* Usually set to false in test environments (e.g. jest).
*/
showDuplicateModelNameWarnings: boolean;
}
/**
* Partially sets the current global config.
*
* @param config Partial object with the new configurations. Options not included in the object won't be changed.
*/
export declare function setGlobalConfig(config: Partial<GlobalConfig>): void;
/**
* Returns the current global config object.
*
* @returns
*/
export declare function getGlobalConfig(): Readonly<GlobalConfig>;