UNPKG

2.1 kBTypeScriptView Raw
1import { ExposeOptions, ExcludeOptions, TypeHelpOptions, TransformOptions, TypeOptions } from "./metadata/ExposeExcludeOptions";
2import { ClassTransformOptions } from "./ClassTransformOptions";
3import { TransformationType } from "./TransformOperationExecutor";
4/**
5 * Defines a custom logic for value transformation.
6 */
7export declare function Transform(transformFn: (value: any, obj: any, transformationType: TransformationType) => any, options?: TransformOptions): (target: any, key: string) => void;
8/**
9 * Specifies a type of the property.
10 * The given TypeFunction can return a constructor. A discriminator can be given in the options.
11 */
12export declare function Type(typeFunction?: (type?: TypeHelpOptions) => Function, options?: TypeOptions): (target: any, key: string) => void;
13/**
14 * Marks property as included in the process of transformation. By default it includes the property for both
15 * constructorToPlain and plainToConstructor transformations, however you can specify on which of transformation types
16 * you want to skip this property.
17 */
18export declare function Expose(options?: ExposeOptions): (object: Object | Function, propertyName?: string) => void;
19/**
20 * Marks property as excluded from the process of transformation. By default it excludes the property for both
21 * constructorToPlain and plainToConstructor transformations, however you can specify on which of transformation types
22 * you want to skip this property.
23 */
24export declare function Exclude(options?: ExcludeOptions): (object: Object | Function, propertyName?: string) => void;
25/**
26 * Transform the object from class to plain object and return only with the exposed properties.
27 */
28export declare function TransformClassToPlain(params?: ClassTransformOptions): Function;
29/**
30 * Return the class instance only with the exposed properties.
31 */
32export declare function TransformClassToClass(params?: ClassTransformOptions): Function;
33/**
34 * Return the class instance only with the exposed properties.
35 */
36export declare function TransformPlainToClass(classType: any, params?: ClassTransformOptions): Function;