ts-deserializable
Version:
Decorator pattern for deserializing unverified data to an instance of a class in typescript.
56 lines (55 loc) • 1.13 kB
TypeScript
export interface DsOperation {
func: Function;
type: DsOperationType;
}
export declare enum DsOperationType {
Operator = "OPERATOR",
Resolver = "RESOLVER",
Validator = "VALIDATOR"
}
declare class DsPropBuilder {
private operations;
private addOperation;
/**
*
* @param func
*/
tap(func: Function): this;
/**
*
* @param func
*/
map(func: Function): this;
/**
*
* @param ctor
*/
mapTo(ctor: any): this;
/**
*
* @param ctor
*/
mapToArray(ctor: any): this;
/**
*
* @param func
*/
resolve(func: Function): this;
/**
*
* @param propPath
*/
dotResolve(propPath: string | string[]): this;
validate(func: Function): this;
validateString(): this;
validateNumber(): this;
validateBoolean(): this;
validateArray(): this;
/**
*
* @param fallbackValue
*/
fb(fallbackValue?: any): (target: any, key: string) => void;
}
export declare const DsProp: () => DsPropBuilder;
export {};