UNPKG

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