UNPKG

1.07 kBTypeScriptView Raw
1/**
2 * Possible transformation options for the @Transform decorator.
3 */
4export interface TransformOptions {
5 /**
6 * First version where this property should be exposed.
7 *
8 * Example:
9 * ```ts
10 * instanceToPlain(payload, { version: 1.0 });
11 * ```
12 */
13 since?: number;
14 /**
15 * Last version where this property should be exposed.
16 *
17 * Example:
18 * ```ts
19 * instanceToPlain(payload, { version: 1.0 });
20 * ```
21 */
22 until?: number;
23 /**
24 * List of transformation groups this property belongs to. When set,
25 * the property will be exposed only when transform is called with
26 * one of the groups specified.
27 *
28 * Example:
29 * ```ts
30 * instanceToPlain(payload, { groups: ['user'] });
31 * ```
32 */
33 groups?: string[];
34 /**
35 * Expose this property only when transforming from plain to class instance.
36 */
37 toClassOnly?: boolean;
38 /**
39 * Expose this property only when transforming from class instance to plain object.
40 */
41 toPlainOnly?: boolean;
42}