UNPKG

type-transformer

Version:

Transformation / serialization / deserialization of plain JavaScript objects to typed objects and vice versa

27 lines (26 loc) 987 B
import { CircularRefStrategy } from './references'; import { SchemaRegistry } from './registry'; export interface TransformationOptions { registry?: SchemaRegistry; circularRefStrategy?: CircularRefStrategy; skipUndefinedProperties?: boolean; } export declare class Transformer { readonly options: TransformationOptions; private referenceGraph; constructor(options: TransformationOptions); toPlain(typed: any, sourceType?: any, existingTarget?: any): any; private applyFieldToPlain; toTyped(plain: any, targetType: any, existingTarget?: any): any; private applyFieldToTyped; private postProcessObject; private getFields; private getSchema; /** * Get the (empty) object to put the source values on. * @param value The source value * @param targetType The optional type of the target * @param existingTarget An object that should be used as target */ private getTargetObject; }