UNPKG

@yamamotok/dataobject

Version:

Decorator based JSON serializer and deserializer.

16 lines (15 loc) 752 B
export declare type Constructor<T = unknown> = new (...args: any[]) => T; export declare type NoArgConstructor<T> = new () => T; export declare type SourceType<T> = { [P in keyof T]?: T[P] | unknown; }; export declare type FactoryFunction<T> = (source?: SourceType<T>, context?: string) => T; export declare type ClassWithFactory<T> = NoArgConstructor<T> & { factory: FactoryFunction<T>; }; export declare type ToPlainFunction<T> = (source: T, context?: string) => Record<string, unknown>; export declare type ClassWithToPlain<T> = NoArgConstructor<T> & { toPlain: ToPlainFunction<T>; }; export declare type DataObjectClass<T> = ClassWithFactory<T> & ClassWithToPlain<T>; export declare const TYPE_ATTRIBUTE_NAME = "__type";