@tsed/common
Version:
A TypeScript Framework on top of Express
50 lines (49 loc) • 1.74 kB
TypeScript
import { MetadataTypes } from "@tsed/core";
import { Configuration, InjectorService } from "@tsed/di";
import { JsonDeserializerOptions, JsonSerializerOptions } from "@tsed/json-mapper";
/**
* @deprecated Since v6.
*/
export interface ConverterOptions extends MetadataTypes {
withIgnoredProps?: boolean;
additionalProperties?: "error" | "ignore" | "accept";
[key: string]: any;
}
export declare class ConverterService {
private injectorService;
private converterSettings;
constructor(injectorService: InjectorService, configuration: Configuration);
/**
* Convert instance to plainObject.
*
* @param obj
* @param options
*/
serialize(obj: any, options?: JsonSerializerOptions): any;
/**
* @deprecated Since v6.
*/
serialize(obj: any, options?: ConverterOptions): any;
/**
* @deprecated Since v6. Use classToPlainObject from @tsed/json-mapper instead
*/
serializeClass(obj: any, options?: ConverterOptions): {};
/**
* Convert a plainObject to targetType.
*
* ### Options
*
* - `ignoreCallback`: callback called for each object which will be deserialized. The callback can return a boolean to avoid the default converter behavior.
* - `checkRequiredValue`: Disable the required check condition.
*
* @param obj Object source that will be deserialized
* @param options Mapping options
* @returns {any}
*/
deserialize(obj: any, options?: JsonDeserializerOptions): any;
deserialize(obj: any, type: any, options?: ConverterOptions): any;
/**
* @deprecated Since v6.
*/
deserialize(obj: any, collectionType: any, baseType: any, options?: ConverterOptions): any;
}