UNPKG

1.77 kBTypeScriptView Raw
1/**
2 * Allows to specify a map of Types in the object without using @Type decorator.
3 * This is useful when you have external classes.
4 */
5export interface TargetMap {
6 /**
7 * Target which Types are being specified.
8 */
9 target: Function;
10 /**
11 * List of properties and their Types.
12 */
13 properties: {
14 [key: string]: Function;
15 };
16}
17/**
18 * Options to be passed during transformation.
19 */
20export interface ClassTransformOptions {
21 /**
22 * Exclusion strategy. By default exposeAll is used, which means that it will expose all properties are transformed
23 * by default.
24 */
25 strategy?: "excludeAll" | "exposeAll";
26 /**
27 * Only properties with given groups gonna be transformed.
28 */
29 groups?: string[];
30 /**
31 * Only properties with "since" > version < "until" gonna be transformed.
32 */
33 version?: number;
34 /**
35 * Excludes properties with the given prefixes. For example, if you mark your private properties with "_" and "__"
36 * you can set this option's value to ["_", "__"] and all private properties will be skipped.
37 * This works only for "exposeAll" strategy.
38 */
39 excludePrefixes?: string[];
40 /**
41 * If set to true then class transformer will ignore all @Expose and @Exclude decorators and what inside them.
42 * This option is useful if you want to kinda clone your object but do not apply decorators affects.
43 */
44 ignoreDecorators?: boolean;
45 /**
46 * Target maps allows to set a Types of the transforming object without using @Type decorator.
47 * This is useful when you are transforming external classes, or if you already have type metadata for
48 * objects and you don't want to set it up again.
49 */
50 targetMaps?: TargetMap[];
51}