ClassConverter

Hierarchy

  • ClassConverter

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

+ new ClassConverter(transformers?: Map‹string, TypeTransformer›): ClassConverter

Creates an instance of ClassConverter. Creates an instance of ClassConverter.

Parameters:

NameTypeDescription
transformers?Map‹string, TypeTransformerOptional transformer mappings implementing TypeTransformer interface.

Returns: ClassConverter

Properties

transformers

transformers: Map‹string, TypeTransformer›

Methods

convert

convert(reflectedType: ObjectType‹› | TupleType‹› | ClassType‹› | ReferenceType‹› | UnionType‹› | StringLiteralType‹› | FunctionType‹› | NumberLiteralType‹› | BaseType‹String, string› | BaseType‹Number, number› | BaseType‹Boolean, boolean› | BaseType‹Null, null› | BaseType‹Undefined, undefined› | BaseType‹ESSymbol, Symbol› | BaseType‹Void, void› | BaseType‹Never, never› | BaseType‹Any, any› | BaseType‹FalseLiteral, false› | BaseType‹TrueLiteral, true› | BaseType‹Unknown, unknown› | BaseType‹Unknown2, unknown› | Class, converter: Converter): Class | any

Converts class.

Parameters:

NameTypeDescription
reflectedTypeObjectType‹› | TupleType‹› | ClassType‹› | ReferenceType‹› | UnionType‹› | StringLiteralType‹› | FunctionType‹› | NumberLiteralType‹› | BaseType‹String, string› | BaseType‹Number, number› | BaseType‹Boolean, boolean› | BaseType‹Null, null› | BaseType‹Undefined, undefined› | BaseType‹ESSymbol, Symbol› | BaseType‹Void, void› | BaseType‹Never, never› | BaseType‹Any, any› | BaseType‹FalseLiteral, false› | BaseType‹TrueLiteral, true› | BaseType‹Unknown, unknown› | BaseType‹Unknown2, unknown› | ClassReflected type.
converterConverterConverter instance.

Returns: Class | any

Returns converted class properties as instance of Class pattern.


isConvertible

isConvertible(reflectedTypeOrClass: tsrTypes.ReflectedType | any): boolean

Evaluates if provided reflected type or argument is a class.

Parameters:

NameTypeDescription
reflectedTypeOrClasstsrTypes.ReflectedType | anyReflected type or argument as a class.

Returns: boolean

Returns true if reflected type or argument is class type, else false.


reflect

reflect(reflectedType: ObjectType‹› | TupleType‹› | ClassType‹› | ReferenceType‹› | UnionType‹› | StringLiteralType‹› | FunctionType‹› | NumberLiteralType‹› | BaseType‹String, string› | BaseType‹Number, number› | BaseType‹Boolean, boolean› | BaseType‹Null, null› | BaseType‹Undefined, undefined› | BaseType‹ESSymbol, Symbol› | BaseType‹Void, void› | BaseType‹Never, never› | BaseType‹Any, any› | BaseType‹FalseLiteral, false› | BaseType‹TrueLiteral, true› | BaseType‹Unknown, unknown› | BaseType‹Unknown2, unknown› | Class, converter: Converter): Record‹keyof any, any›

Reflect class properties and their matching expectations.

Parameters:

NameTypeDescription
reflectedTypeObjectType‹› | TupleType‹› | ClassType‹› | ReferenceType‹› | UnionType‹› | StringLiteralType‹› | FunctionType‹› | NumberLiteralType‹› | BaseType‹String, string› | BaseType‹Number, number› | BaseType‹Boolean, boolean› | BaseType‹Null, null› | BaseType‹Undefined, undefined› | BaseType‹ESSymbol, Symbol› | BaseType‹Void, void› | BaseType‹Never, never› | BaseType‹Any, any› | BaseType‹FalseLiteral, false› | BaseType‹TrueLiteral, true› | BaseType‹Unknown, unknown› | BaseType‹Unknown2, unknown› | ClassReflected type.
converterConverterConverter instance.

Returns: Record‹keyof any, any›

Returns reflected class properties as an Object.