UNPKG

jstorm

Version:

JavaScript Storage ORM (Object-Relational Mapper) for LocalStorage and Chrome Storage API

28 lines (27 loc) 987 B
import type { Model } from "../model"; import type { TypeCheckFunc } from "./base"; /** * ModelTypeOption can specify the options of reference type. */ export interface ModelTypeOption { /** * eager: * If it's true, methods like `find` will try to load * the newest data for the referenced models. * Otherwise the referenced models will be just decoded class instances * stored under this parent's namespace. */ eager?: boolean; } /** * referenceTypeChecker is a generator function of type checker * with referencing another Model, known as "relations". * The generated type checker function also includes "decode" function * so that the referenced peoperties can be decoded * at the same time on decoding the root model. * * @param {function} refConstructor * @param {ReferenceTypeOption} opt * @return {TypeCheckFunc} */ export declare function modelTypeChecker(refConstructor: typeof Model, opt?: ModelTypeOption): TypeCheckFunc;