@juneil/tschema
Version:
41 lines (40 loc) • 1.55 kB
TypeScript
import 'reflect-metadata';
import { AnyClass } from './common';
export declare type ClassProperty = {
key: string;
rules: {
rule: Symbol;
value: any;
}[];
result?: object;
};
/**
* Integer decorator
*/
declare function integerDecorator(): (target: any, key: string) => void;
declare function itemDecorator(type: String | Number | Boolean | Object | AnyClass): (target: any, key: string) => void;
declare function enumDecorator(...values: any[]): (target: any, key: string) => void;
/**
* Required decorator
*/
declare function requiredDecorator(): (target: any, key: string) => void;
/**
* Called by the @Property decorator
* Add the property type in the class metadata
*/
declare function propertyDecorator(): (target: any, key: string) => void;
export declare function getProperties(target: AnyClass): ClassProperty[];
declare function serialize(target: any): any;
declare function containsProperties(token: AnyClass): boolean;
declare function propertiesList(token: AnyClass): {
[prop: string]: Object | String | Number | Boolean | Function | undefined;
};
export declare const Optional: typeof propertyDecorator;
export declare const Required: typeof requiredDecorator;
export declare const Integer: typeof integerDecorator;
export declare const Item: typeof itemDecorator;
export declare const Enum: typeof enumDecorator;
export declare const isTSchema: typeof containsProperties;
export declare const serializer: typeof serialize;
export declare const properties: typeof propertiesList;
export {};