-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserialize.d.ts
30 lines (30 loc) · 1.11 KB
/
serialize.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
export declare abstract class SerializeModel {
static replacingMap?: TReplacingMap<any>;
}
export interface TModelConstructor<T, I> extends SerializeModel {
replacingMap?: TReplacingMap<T>;
new (args: I): T;
}
export declare type TReplacingMap<T = Record<string, any>> = {
[key: string]: keyof T;
};
declare type TSerialize<T, A> = {
data: Record<string, any>;
root?: keyof Record<string, any>;
instanceConstructor: TModelConstructor<T, A>;
};
export declare function serialized<BaseType, GenericType>(instanceConstructor: TModelConstructor<BaseType, BaseType>): (target: Record<string, any>, propertyKey: string) => any;
export declare class Serialize<T extends SerializeModel, K, A> implements TSerialize<T, A> {
model?: any;
data: Record<string, any>;
root?: keyof Record<string, any>;
replacingMap?: TReplacingMap<T>;
instanceConstructor: TModelConstructor<T, A>;
constructor({ data, root, instanceConstructor }: TSerialize<T, A>);
private replaceKeys;
private getRoot;
private createModel;
getModel: () => K;
}
export {};
//# sourceMappingURL=serialize.d.ts.map