UNPKG

2.22 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 * Indicates if extraneous properties should be excluded from the value when converting a plain value to a class.
28 */
29 excludeExtraneousValues?: boolean;
30 /**
31 * Only properties with given groups gonna be transformed.
32 */
33 groups?: string[];
34 /**
35 * Only properties with "since" > version < "until" gonna be transformed.
36 */
37 version?: number;
38 /**
39 * Excludes properties with the given prefixes. For example, if you mark your private properties with "_" and "__"
40 * you can set this option's value to ["_", "__"] and all private properties will be skipped.
41 * This works only for "exposeAll" strategy.
42 */
43 excludePrefixes?: string[];
44 /**
45 * If set to true then class transformer will ignore all @Expose and @Exclude decorators and what inside them.
46 * This option is useful if you want to kinda clone your object but do not apply decorators affects.
47 */
48 ignoreDecorators?: boolean;
49 /**
50 * Target maps allows to set a Types of the transforming object without using @Type decorator.
51 * This is useful when you are transforming external classes, or if you already have type metadata for
52 * objects and you don't want to set it up again.
53 */
54 targetMaps?: TargetMap[];
55 /**
56 * If set to true then class transformer will perform a circular check. (circular check is turned off by default)
57 * This option is useful when you know for sure that your types might have a circular dependency.
58 */
59 enableCircularCheck?: boolean;
60}