forked from jf3096/json-typescript-mapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
42 lines (42 loc) · 1.09 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
import 'reflect-metadata';
import { IDecoratorMetaData } from './';
/**
* provide interface to indicate the object is allowed to be traversed
*
* @interface
*/
export interface IGenericObject {
[key: string]: any;
}
/**
* IDecoratorMetaData<T>
* DecoratorConstraint
*
* @interface
*/
export interface IDecoratorMetaData<T> {
name?: string;
clazz?: {
new (): T;
};
}
/**
* JsonProperty
*
* @function
* @property {IDecoratorMetaData<T>|string} metadata, encapsulate it to DecoratorMetaData for standard use
* @return {(target:Object, targetKey:string | symbol)=> void} decorator function
*/
export declare function JsonProperty<T>(metadata?: IDecoratorMetaData<T> | string): (target: Object, targetKey: string | symbol) => void;
/**
* deserialize
*
* @function
* @param {{new():T}} clazz, class type which is going to initialize and hold a mapping json
* @param {Object} json, input json object which to be mapped
*
* @return {T} return mapped object
*/
export declare function deserialize<T extends IGenericObject>(Clazz: {
new (): T;
}, json: IGenericObject): T;