UnionConverter

Hierarchy

  • UnionConverter

Implements

Index

Methods

Methods

convert

convert(reflectedType: tsruntimeTypes.ReflectedType, converter: Converter): Optional | OneOf

Converts union.

Parameters:

NameTypeDescription
reflectedTypetsruntimeTypes.ReflectedTypeReflected type.
converterConverterConverter instance.

Returns: Optional | OneOf

Returns converted union as an instance of OneOf pattern or instance of Optional pattern(for class properties defined with question mark symbol or matching pattern[undefined, any]).


isConvertible

isConvertible(reflectedType: tsruntimeTypes.ReflectedType): boolean

Evaluates if provided reflected type is an union.

Parameters:

NameTypeDescription
reflectedTypetsruntimeTypes.ReflectedTypeReflected type.

Returns: boolean

Returns true if reflected type is an union, else false.


reflect

reflect(reflectedType: tsruntimeTypes.ReflectedType, converter: Converter): any[]

Reflects union.

Parameters:

NameTypeDescription
reflectedTypetsruntimeTypes.ReflectedTypeReflected type.
converterConverterConverter instance.

Returns: any[]

Returns reflected union as an Array.