-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
63 lines (63 loc) · 3.29 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { ClassType } from "./ClassTransformer";
import { ClassTransformOptions } from "./ClassTransformOptions";
export { ClassTransformer } from "./ClassTransformer";
export { ClassTransformOptions } from "./ClassTransformOptions";
export * from "./metadata/ExposeExcludeOptions";
export * from "./decorators";
/**
* Converts class (constructor) object to plain (literal) object. Also works with arrays.
*/
export declare function classToPlain<T>(object: T, options?: ClassTransformOptions): Object;
export declare function classToPlain<T>(object: T[], options?: ClassTransformOptions): Object[];
/**
* Converts class (constructor) object to plain (literal) object.
* Uses given plain object as source object (it means fills given plain object with data from class object).
* Also works with arrays.
*/
export declare function classToPlainFromExist<T>(object: T, plainObject: Object, options?: ClassTransformOptions): Object;
export declare function classToPlainFromExist<T>(object: T, plainObjects: Object[], options?: ClassTransformOptions): Object[];
/**
* Converts plain (literal) object to class (constructor) object. Also works with arrays.
*/
export declare function plainToClass<T, V extends Array<any>>(cls: ClassType<T>, plain: V, options?: ClassTransformOptions): T[];
export declare function plainToClass<T, V>(cls: ClassType<T>, plain: V, options?: ClassTransformOptions): T;
/**
* Converts plain (literal) object to class (constructor) object.
* Uses given object as source object (it means fills given object with data from plain object).
* Also works with arrays.
*/
export declare function plainToClassFromExist<T, V extends Array<any>>(clsObject: T[], plain: V, options?: ClassTransformOptions): T[];
export declare function plainToClassFromExist<T, V>(clsObject: T, plain: V, options?: ClassTransformOptions): T;
/**
* Converts class (constructor) object to new class (constructor) object. Also works with arrays.
*/
export declare function classToClass<T>(object: T, options?: ClassTransformOptions): T;
export declare function classToClass<T>(object: T[], options?: ClassTransformOptions): T[];
/**
* Converts class (constructor) object to plain (literal) object.
* Uses given plain object as source object (it means fills given plain object with data from class object).
* Also works with arrays.
*/
export declare function classToClassFromExist<T>(object: T, fromObject: T, options?: ClassTransformOptions): T;
export declare function classToClassFromExist<T>(object: T, fromObjects: T[], options?: ClassTransformOptions): T[];
/**
* Serializes given object to a JSON string.
*/
export declare function serialize<T>(object: T, options?: ClassTransformOptions): string;
export declare function serialize<T>(object: T[], options?: ClassTransformOptions): string;
/**
* Deserializes given JSON string to a object of the given class.
*/
export declare function deserialize<T>(cls: ClassType<T>, json: string, options?: ClassTransformOptions): T;
/**
* Deserializes given JSON string to an array of objects of the given class.
*/
export declare function deserializeArray<T>(cls: ClassType<T>, json: string, options?: ClassTransformOptions): T[];
/**
* Enum representing the different transformation types.
*/
export declare enum TransformationType {
PLAIN_TO_CLASS = 0,
CLASS_TO_PLAIN = 1,
CLASS_TO_CLASS = 2,
}