Skip to main content

Class: VUnion<Type, T, IsOptional, FieldPaths>

For AI agents: see llms.txt for the complete documentation index. Markdown versions are available by adding .md to a page URL or requesting Accept: text/markdown.

values.VUnion

The type of the v.union() validator.

Type parameters​

NameType
TypeType
Textends Validator<any, "required", any>[]
IsOptionalextends OptionalProperty = "required"
FieldPathsextends string = T[number]["fieldPaths"]

Hierarchy​

  • BaseValidator<Type, IsOptional, FieldPaths>

    ↳ VUnion

Constructors​

constructor​

• new VUnion<Type, T, IsOptional, FieldPaths>(«destructured»)

Usually you'd use v.union(...members) instead.

Type parameters​

NameType
TypeType
Textends Validator<any, "required", any>[]
IsOptionalextends OptionalProperty = "required"
FieldPathsextends string = T[number]["fieldPaths"]

Parameters​

NameType
«destructured»Object
› isOptionalIsOptional
› membersT

Overrides​

BaseValidator&lt;Type, IsOptional, FieldPaths&gt;.constructor

Defined in​

values/validators.ts:697

Properties​

type​

• Readonly type: Type

Only for TypeScript, the TS type of the JS values validated by this validator.

Inherited from​

BaseValidator.type

Defined in​

values/validators.ts:37


fieldPaths​

• Readonly fieldPaths: FieldPaths

Only for TypeScript, if this an Object validator, then this is the TS type of its property names.

Inherited from​

BaseValidator.fieldPaths

Defined in​

values/validators.ts:42


isOptional​

• Readonly isOptional: IsOptional

Whether this is an optional Object property value validator.

Inherited from​

BaseValidator.isOptional

Defined in​

values/validators.ts:47


isConvexValidator​

• Readonly isConvexValidator: true

Always "true".

Inherited from​

BaseValidator.isConvexValidator

Defined in​

values/validators.ts:52


members​

• Readonly members: T

The array of validators, one of which must match the value.

Defined in​

values/validators.ts:687


kind​

• Readonly kind: "union"

The kind of validator, "union".

Defined in​

values/validators.ts:692

Methods​

optional​

▸ optional(): VUnion<undefined | Type, T, "optional", FieldPaths>

Allow this validated field to be absent.

Returns​

VUnion<undefined | Type, T, "optional", FieldPaths>

Overrides​

BaseValidator.optional

Defined in​

values/validators.ts:717