warehouse
Version:
Simple JSON-based database
39 lines (38 loc) • 869 B
TypeScript
import SchemaType from '../schematype';
/**
* Virtual schema type.
*/
declare class SchemaTypeVirtual<T = any> extends SchemaType<any> {
getter: ((this: T) => any) | undefined;
setter: ((value: any) => void) | undefined;
/**
* Add a getter.
*
* @param {Function} fn
* @chainable
*/
get(fn: (this: T) => any): SchemaTypeVirtual<T>;
/**
* Add a setter.
*
* @param {Function} fn
* @chainable
*/
set(fn: (this: T, value: any) => void): SchemaTypeVirtual<T>;
/**
* Applies getters.
*
* @param {*} value
* @param {Object} data
* @return {*}
*/
cast(value: unknown, data: any): void;
/**
* Applies setters.
*
* @param {*} value
* @param {Object} data
*/
validate(value: any, data: any): void;
}
export default SchemaTypeVirtual;