Home > @skunkteam/types > UnionType
The implementation behind types created with union() and BaseTypeImpl.or().
Signature:
declare class UnionType<Types extends OneOrMore<BaseTypeImpl<unknown>>, ResultType extends TypeOf<Types[number]> = TypeOf<Types[number]>> extends BaseObjectLikeTypeImpl<ResultType>
Extends: BaseObjectLikeTypeImpl<ResultType>
Constructor | Modifiers | Description |
---|---|---|
(constructor)(types, name) | Constructs a new instance of the UnionType class |
Property | Modifiers | Type | Description |
---|---|---|---|
basicType | readonly |
BasicType | "mixed" | The kind of values this type validates. |
collapsedTypes | readonly |
Types | |
enumerableLiteralDomain | readonly |
Set<LiteralValue> | undefined | The set of valid literals if enumerable. |
isDefaultName | readonly |
boolean | |
name | readonly |
string | The name of the Type. |
possibleDiscriminators | readonly |
readonly PossibleDiscriminator[] | |
props | readonly |
Properties | |
propsInfo | readonly |
PropertiesInfo<Properties> | |
typeConfig | readonly |
undefined | Extra information that is made available by this Type for runtime analysis. |
types | readonly |
Types |
Method | Modifiers | Description |
---|---|---|
accept(visitor) | Accept a visitor (visitor pattern). | |
findApplicableSubtype(input) | ||
maybeStringify(value) | Create a JSON string of the given value, using the type information of the current type. Matches the specs of JSON.stringify . |
|
typeValidator(input, options) | protected |
The actual validation-logic. |