ClassConverter
Hierarchy
- ClassConverter
Implements
- TypeConverter
- TypeConverter
Index
Constructors
Properties
Methods
Constructors
constructor
+ new ClassConverter(transformers?
: Map‹string, TypeTransformer›): ClassConverter
Creates an instance of ClassConverter. Creates an instance of ClassConverter.
Parameters:
Name | Type | Description |
---|---|---|
transformers? | Map‹string, TypeTransformer› | Optional 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:
Name | Type | Description |
---|---|---|
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 | Reflected type. |
converter | Converter | Converter 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:
Name | Type | Description |
---|---|---|
reflectedTypeOrClass | tsrTypes.ReflectedType | any | Reflected 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:
Name | Type | Description |
---|---|---|
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 | Reflected type. |
converter | Converter | Converter instance. |
Returns: Record‹keyof any, any›
Returns reflected class properties as an Object
.