/** * A unique symbol to identify a model. * * Converts a model to unwrapped value. */ export declare const toModelValue: unique symbol; /** * Since there is no reference or pointer of primitive type in JavaScript, * this is a wrapper of primitive type to make it possible to pass by reference. */ export interface JustModel { /** * The model value. */ value: T; /** * Convert to unwrapped value. */ [toModelValue](): T; /** * Convert to primitive value. */ [Symbol.toPrimitive](): T; } /** * A utility type. * * Commonly used in component function parameters which accept both primitive type and model. */ export type Model = T | JustModel; /** * Create a model. * * @param v The initial value. * @returns The created model. */ export declare function model(v: T): JustModel; /** * Check whether a value is a model. * * @param m The value to check. * @returns Whether the value is a model. */ export declare function isModel(m: Model): m is JustModel; /** * Update the value of a model. * * **Warning**: This function is dangerous. It will mutate the model value without triggering an `UPDATE` call. * * @param m The model. * @param v The new value. * @returns Whether the value is changed. */ export declare function dangerously_updateModel(m: Model, v: T): boolean; /** * Get the unwrapped value. * * @param v Maybe a model. * @returns The unwrapped value. */ export declare function unwrap(v: Model): T; //# sourceMappingURL=model.d.ts.map