import { PropertyCompilerSchema, Types } from "./decorators"; export declare type TypeConverterCompilerContext = Map; export declare type TypeConverterCompiler = (setter: string, accessor: string, property: PropertyCompilerSchema, reserveVariable: () => string, context: TypeConverterCompilerContext) => string | { template: string; context: { [name: string]: any; }; }; export declare const compilerRegistry: Map; /** * Registers a new compiler template for a certain type in certain direction * (plain to class, class to plain for example). * * Note: Don't handle isArray/isMap/isPartial or isOptional at `property` as those are already handled before * your compiler code is called. Focus on marshalling the given type as fast and clear as possible. * The value you can access via `accessor` is at this stage never undefined and never null. * * Note: When you come from `class` to x (registerConverterCompile('class', x)) then values additionally are * guaranteed to have certain value types since the TS system enforces it. Marshal plainToClass made that sure as well. * If a user overwrites with `as any` its not our business to convert them implicitly. * * Warning: Context is shared across types, so make sure either your assigned names are unique or generate new variable * name using `reserveVariable`. * * INTERNAL WARNING: However, coming from `plain` to `x` the property values usually come from user input which makes * it necessary to check the type and convert it if necessary. This is extremely important to not * introduce security issues. As third-party integration you should however not handle fromFormat='plain', * as this is made in the core. Marshaling from plain to your target platform is made by calling first plainToClass() * and then classToX(), Marshal is fast enough to buy this convenience (of not having to declare too many compiler * templates). */ export declare function registerConverterCompiler(fromFormat: string, toFormat: string, type: Types, compiler: TypeConverterCompiler): void; export declare function reserveVariable(rootContext: TypeConverterCompilerContext, name?: string): string; export declare function executeCompiler(rootContext: TypeConverterCompilerContext, compiler: TypeConverterCompiler, setter: string, getter: string, property: PropertyCompilerSchema): string; export declare function getDataConverterJS(setter: string, accessor: string, property: PropertyCompilerSchema, fromFormat: string, toFormat: string, rootContext: TypeConverterCompilerContext): string;