import { ClassTransformOptions } from './interfaces'; import { ClassConstructor } from './interfaces'; export declare class ClassTransformer { /** * Converts class (constructor) object to plain (literal) object. Also works with arrays. */ instanceToPlain>(object: T, options?: ClassTransformOptions): Record; instanceToPlain>(object: T[], options?: ClassTransformOptions): Record[]; /** * 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. */ classToPlainFromExist, P>(object: T, plainObject: P, options?: ClassTransformOptions): T; classToPlainFromExist, P>(object: T, plainObjects: P[], options?: ClassTransformOptions): T[]; /** * Converts plain (literal) object to class (constructor) object. Also works with arrays. */ plainToInstance, V extends Array>(cls: ClassConstructor, plain: V, options?: ClassTransformOptions): T[]; plainToInstance, V>(cls: ClassConstructor, 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. */ plainToClassFromExist, V extends Array>(clsObject: T, plain: V, options?: ClassTransformOptions): T; plainToClassFromExist, V>(clsObject: T, plain: V, options?: ClassTransformOptions): T[]; /** * Converts class (constructor) object to new class (constructor) object. Also works with arrays. */ instanceToInstance(object: T, options?: ClassTransformOptions): T; instanceToInstance(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. */ classToClassFromExist(object: T, fromObject: T, options?: ClassTransformOptions): T; classToClassFromExist(object: T, fromObjects: T[], options?: ClassTransformOptions): T[]; /** * Serializes given object to a JSON string. */ serialize(object: T, options?: ClassTransformOptions): string; serialize(object: T[], options?: ClassTransformOptions): string; /** * Deserializes given JSON string to a object of the given class. */ deserialize(cls: ClassConstructor, json: string, options?: ClassTransformOptions): T; /** * Deserializes given JSON string to an array of objects of the given class. */ deserializeArray(cls: ClassConstructor, json: string, options?: ClassTransformOptions): T[]; }