Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 5.85 KB

types.uniontype.md

File metadata and controls

45 lines (33 loc) · 5.85 KB

Home > @skunkteam/types > UnionType

UnionType class

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>

Constructors

Constructor Modifiers Description
(constructor)(types, name) Constructs a new instance of the UnionType class

Properties

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

Methods

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.