Class: UnionSchema<TType, TContext, TDefault, TFlags>

Extends

  • Schema<TType, TContext, TDefault, TFlags>

Type Parameters

TType = any

TContext = AnyObject

TDefault = undefined

TFlags extends Flags = ""

Implements

Constructors

new UnionSchema()

new UnionSchema<TType, TContext, TDefault, TFlags>(types): UnionSchema<TType, TContext, TDefault, TFlags>

Parameters

types: readonly Schema<any, any, any, "">[]

Returns

UnionSchema<TType, TContext, TDefault, TFlags>

Overrides

Schema<TType, TContext, TDefault, TFlags>.constructor

Defined in

packages/yup/src/union.ts:38

Properties

__context

readonly __context: TContext

Implementation of

IUnionSchema.__context

Inherited from

Schema.__context

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:162


__default

readonly __default: TDefault

Implementation of

IUnionSchema.__default

Inherited from

Schema.__default

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:165


__flags

readonly __flags: TFlags

Implementation of

IUnionSchema.__flags

Inherited from

Schema.__flags

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:163


__isYupSchema__

readonly __isYupSchema__: boolean

Implementation of

IUnionSchema.__isYupSchema__

Inherited from

Schema.__isYupSchema__

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:164


__outputType

readonly __outputType: ResolveFlags<TType, TFlags, TDefault>

Implementation of

IUnionSchema.__outputType

Inherited from

Schema.__outputType

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:161


_blacklist

protected _blacklist: ReferenceSet

Implementation of

IUnionSchema._blacklist

Inherited from

Schema._blacklist

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:173


_typeCheck()

protected _typeCheck: (value) => value is NonNullable<TType>

Parameters

value: any

Returns

value is NonNullable<TType>

Implementation of

IUnionSchema._typeCheck

Inherited from

Schema._typeCheck

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:175


_whitelist

protected _whitelist: ReferenceSet

Implementation of

IUnionSchema._whitelist

Inherited from

Schema._whitelist

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:172


deps

readonly deps: readonly string[]

Implementation of

IUnionSchema.deps

Inherited from

Schema.deps

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:166


equals()

equals: <U>(enums, message?) => this(enums, message) => any

Type Parameters

U extends any

Parameters

enums: readonly (Reference<unknown> | U)[]

message?: Message<object>

Returns

this

Parameters

enums: readonly any[]

message: Message<object>

Returns

any

Implementation of

IUnionSchema.equals

Inherited from

Schema.equals

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:261


exclusiveTests

protected exclusiveTests: Record<string, boolean>

Implementation of

IUnionSchema.exclusiveTests

Inherited from

Schema.exclusiveTests

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:174


is()

is: <U>(enums, message?) => this(enums, message) => any

Type Parameters

U extends any

Parameters

enums: readonly (Reference<unknown> | U)[]

message?: Message<object>

Returns

this

Parameters

enums: readonly any[]

message: Message<object>

Returns

any

Implementation of

IUnionSchema.is

Inherited from

Schema.is

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:262


nope()

nope: <U>(enums, message?) => this

Type Parameters

U extends any

Parameters

enums: readonly (Reference<unknown> | Maybe<U>)[]

message?: Message<object>

Returns

this

Implementation of

IUnionSchema.nope

Inherited from

Schema.nope

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:264


not()

not: <U>(enums, message?) => this

Type Parameters

U extends any

Parameters

enums: readonly (Reference<unknown> | Maybe<U>)[]

message?: Message<object>

Returns

this

Implementation of

IUnionSchema.not

Inherited from

Schema.not

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:263


spec

spec: UnionSchemaSpec

Implementation of

IUnionSchema.spec

Overrides

Schema.spec

Defined in

packages/yup/src/union.ts:36


tests

tests: Test[]

Implementation of

IUnionSchema.tests

Inherited from

Schema.tests

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:167


transforms

transforms: TransformFunction<AnySchema<any, any, any, Flags>>[]

Implementation of

IUnionSchema.transforms

Inherited from

Schema.transforms

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:168


type

readonly type: string

Implementation of

IUnionSchema.type

Inherited from

Schema.type

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:160

Accessors

_type

get _type(): string

Returns

string

Implementation of

IUnionSchema._type

Inherited from

Schema._type

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:178

Methods

_cast()

protected _cast(rawValue, options): any

Parameters

rawValue: any

options: CastOptions$1<TContext>

Returns

any

Implementation of

IUnionSchema._cast

Inherited from

Schema._cast

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:194


_getDefault()

protected _getDefault(options?): any

Parameters

options?: ResolveOptions<TContext>

Returns

any

Implementation of

IUnionSchema._getDefault

Inherited from

Schema._getDefault

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:206


_validate()

protected _validate(_value, options, panic, next): void

Parameters

_value: any

options: undefined | InternalOptions<TContext>

panic

next

Returns

void

Implementation of

IUnionSchema._validate

Inherited from

Schema._validate

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:195


asNestedTest()

asNestedTest(__namedParameters): RunTest

Parameters

__namedParameters: NestedTestConfig

Returns

RunTest

Implementation of

IUnionSchema.asNestedTest

Inherited from

Schema.asNestedTest

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:201


cast()

cast(value, options): any

Run the configured transform pipeline over an input value.

Parameters

value: any

options: any

Returns

any

Implementation of

IUnionSchema.cast

Overrides

Schema.cast

Defined in

packages/yup/src/union.ts:48


clone()

clone(spec?): this

Parameters

spec?: Partial<SchemaSpec<any>>

Returns

this

Implementation of

IUnionSchema.clone

Inherited from

Schema.clone

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:179


concat()

concat(schema)

concat(schema): this

Parameters

schema: this

Returns

this

Implementation of

IUnionSchema.concat

Inherited from

Schema.concat

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:184

concat(schema)

concat(schema): AnySchema<any, any, any, Flags>

Parameters

schema: AnySchema<any, any, any, Flags>

Returns

AnySchema<any, any, any, Flags>

Implementation of

IUnionSchema.concat

Inherited from

Schema.concat

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:185


default()

default(def): any

Parameters

def: any

Returns

any

Implementation of

IUnionSchema.default

Inherited from

Schema.default

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:208


defined()

defined(message?): any

Parameters

message?: Message<any>

Returns

any

Implementation of

IUnionSchema.defined

Inherited from

Schema.defined

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:213


describe()

describe(...arg): SchemaInnerTypeDescription

Return a serialized description of the schema including validations, flags, types etc.

Parameters

• ...arg: [ResolveOptions<any>]

Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).

Returns

SchemaInnerTypeDescription

Implementation of

IUnionSchema.describe

Overrides

Schema.describe

Defined in

packages/yup/src/union.ts:75


findTargetSchema()

findTargetSchema(value): Promise<undefined | Schema<any, any, any, "">>

Parameters

value: any

Returns

Promise<undefined | Schema<any, any, any, "">>

Implementation of

IUnionSchema.findTargetSchema

Defined in

packages/yup/src/union.ts:101


findTargetSchemaSync()

findTargetSchemaSync(value): undefined | Schema<any, any, any, "">

Parameters

value: any

Returns

undefined | Schema<any, any, any, "">

Implementation of

IUnionSchema.findTargetSchemaSync

Defined in

packages/yup/src/union.ts:108


getDefault()

getDefault(options?): TDefault

Parameters

options?: ResolveOptions<TContext>

Returns

TDefault

Implementation of

IUnionSchema.getDefault

Inherited from

Schema.getDefault

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:207


isType()

isType(v): v is TType

Parameters

v: unknown

Returns

v is TType

Implementation of

IUnionSchema.isType

Inherited from

Schema.isType

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:186


isValid()

isValid(value, options?): Promise<boolean>

Parameters

value: any

options?: ValidateOptions<TContext>

Returns

Promise<boolean>

Implementation of

IUnionSchema.isValid

Inherited from

Schema.isValid

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:204


isValidSync()

isValidSync(value, options?): value is ResolveFlags<TType, TFlags, TDefault>

Parameters

value: any

options?: ValidateOptions<TContext>

Returns

value is ResolveFlags<TType, TFlags, TDefault>

Implementation of

IUnionSchema.isValidSync

Inherited from

Schema.isValidSync

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:205


label()

label(label): this

Parameters

label: string

Returns

this

Implementation of

IUnionSchema.label

Inherited from

Schema.label

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:180


meta()

meta(undefined)

meta(): undefined | CustomSchemaMetadata

Returns

undefined | CustomSchemaMetadata

Implementation of

IUnionSchema.meta

Inherited from

Schema.meta

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:181

meta(obj)

meta(obj): this

Parameters

obj: CustomSchemaMetadata

Returns

this

Implementation of

IUnionSchema.meta

Inherited from

Schema.meta

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:182


nonNullable()

nonNullable(message?): any

Parameters

message?: Message<any>

Returns

any

Implementation of

IUnionSchema.nonNullable

Inherited from

Schema.nonNullable

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:215


notOneOf()

notOneOf<U>(enums, message?): this

Type Parameters

U

Parameters

enums: readonly (Reference<unknown> | Maybe<U>)[]

message?: Message<object>

Returns

this

Implementation of

IUnionSchema.notOneOf

Inherited from

Schema.notOneOf

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:247


notRequired()

notRequired(): any

Returns

any

Implementation of

IUnionSchema.notRequired

Inherited from

Schema.notRequired

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:217


nullability()

protected nullability(nullable, message?): this

Parameters

nullable: boolean

message?: Message<any>

Returns

this

Implementation of

IUnionSchema.nullability

Inherited from

Schema.nullability

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:210


nullable()

nullable(): any

Returns

any

Implementation of

IUnionSchema.nullable

Inherited from

Schema.nullable

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:214


oneOf()

oneOf(enums, message)

oneOf<U>(enums, message?): this

Type Parameters

U

Parameters

enums: readonly (U | Reference<unknown>)[]

message?: Message<object>

Returns

this

Implementation of

IUnionSchema.oneOf

Inherited from

Schema.oneOf

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:241

oneOf(enums, message)

oneOf(enums, message): any

Parameters

enums: readonly (TType | Reference<unknown>)[]

message: Message<object>

Returns

any

Implementation of

IUnionSchema.oneOf

Inherited from

Schema.oneOf

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:244


optional()

optional(): any

Returns

any

Implementation of

IUnionSchema.optional

Inherited from

Schema.optional

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:212


optionality()

protected optionality(optional, message?): this

Parameters

optional: boolean

message?: Message<any>

Returns

this

Implementation of

IUnionSchema.optionality

Inherited from

Schema.optionality

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:211


required()

required(message?): any

Parameters

message?: Message<any>

Returns

any

Implementation of

IUnionSchema.required

Inherited from

Schema.required

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:216


resolve()

resolve(options): this

Parameters

options: ResolveOptions<TContext>

Returns

this

Implementation of

IUnionSchema.resolve

Inherited from

Schema.resolve

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:187


resolveOptions()

protected resolveOptions<T>(options): T

Type Parameters

T extends InternalOptions<any>

Parameters

options: T

Returns

T

Implementation of

IUnionSchema.resolveOptions

Inherited from

Schema.resolveOptions

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:188


runTests()

protected runTests(runOptions, panic, next): void

Executes a set of validations, either schema, produced Tests or a nested schema validate result.

Parameters

runOptions: TestRunOptions

panic

next

Returns

void

Implementation of

IUnionSchema.runTests

Inherited from

Schema.runTests

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:200


strict()

strict(isStrict?): this

Parameters

isStrict?: boolean

Returns

this

Implementation of

IUnionSchema.strict

Inherited from

Schema.strict

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:209


strip()

strip(strip?): any

Parameters

strip?: boolean

Returns

any

Implementation of

IUnionSchema.strip

Inherited from

Schema.strip

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:250


test()

test(options)

test(options): this

Adds a test function to the schema's queue of tests. tests can be exclusive or non-exclusive.

  • exclusive tests, will replace any existing tests of the same name.
  • non-exclusive: can be stacked

If a non-exclusive test is added to a schema with an exclusive test of the same name the exclusive test is removed and further tests of the same name will be stacked.

If an exclusive test is added to a schema with non-exclusive tests of the same name the previous tests are removed and further tests of the same name will replace each other.

Parameters

options: TestConfig<ResolveFlags<TType, TFlags, TDefault>, TContext>

Returns

this

Implementation of

IUnionSchema.test

Inherited from

Schema.test

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:232

test(test)

test(test): this

Parameters

test: TestFunction<ResolveFlags<TType, TFlags, TDefault>, TContext>

Returns

this

Implementation of

IUnionSchema.test

Inherited from

Schema.test

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:233

test(name, test)

test(name, test): this

Parameters

name: string

test: TestFunction<ResolveFlags<TType, TFlags, TDefault>, TContext>

Returns

this

Implementation of

IUnionSchema.test

Inherited from

Schema.test

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:234

test(name, message, test)

test(name, message, test): this

Parameters

name: string

message: Message<any>

test: TestFunction<ResolveFlags<TType, TFlags, TDefault>, TContext>

Returns

this

Implementation of

IUnionSchema.test

Inherited from

Schema.test

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:235


transform()

transform(fn): this

Parameters

fn: TransformFunction<UnionSchema<TType, TContext, TDefault, TFlags>>

Returns

this

Implementation of

IUnionSchema.transform

Inherited from

Schema.transform

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:218


typeError()

typeError(message): this

Parameters

message: Message<any>

Returns

this

Implementation of

IUnionSchema.typeError

Inherited from

Schema.typeError

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:240


validate()

validate(...args): Promise<any>

Parameters

• ...args: [any, ValidateOptions<any>]

Returns

Promise<any>

Implementation of

IUnionSchema.validate

Overrides

Schema.validate

Defined in

packages/yup/src/union.ts:54


validateAt()

validateAt(path, value, options?): Promise<any>

Parameters

path: string

value: any

options?: ValidateOptions<TContext>

Returns

Promise<any>

Implementation of

IUnionSchema.validateAt

Inherited from

Schema.validateAt

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:259


validateNil()

validateNil(value): boolean

Parameters

value: any

Returns

boolean

Defined in

packages/yup/src/union.ts:95


validateSync()

validateSync(...args): any

Parameters

• ...args: [any, ValidateOptions<any>]

Returns

any

Implementation of

IUnionSchema.validateSync

Overrides

Schema.validateSync

Defined in

packages/yup/src/union.ts:65


validateSyncAt()

validateSyncAt(path, value, options?): any

Parameters

path: string

value: any

options?: ValidateOptions<TContext>

Returns

any

Implementation of

IUnionSchema.validateSyncAt

Inherited from

Schema.validateSyncAt

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:260


when()

when(builder)

when(builder): this

Parameters

builder: ConditionBuilder<UnionSchema<TType, TContext, TDefault, TFlags>>

Returns

this

Implementation of

IUnionSchema.when

Inherited from

Schema.when

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:236

when(keys, builder)

when(keys, builder): this

Parameters

keys: string | string[]

builder: ConditionBuilder<UnionSchema<TType, TContext, TDefault, TFlags>>

Returns

this

Implementation of

IUnionSchema.when

Inherited from

Schema.when

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:237

when(options)

when(options): this

Parameters

options: ConditionConfig<UnionSchema<TType, TContext, TDefault, TFlags>>

Returns

this

Implementation of

IUnionSchema.when

Inherited from

Schema.when

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:238

when(keys, options)

when(keys, options): this

Parameters

keys: string | string[]

options: ConditionConfig<UnionSchema<TType, TContext, TDefault, TFlags>>

Returns

this

Implementation of

IUnionSchema.when

Inherited from

Schema.when

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:239


withMutation()

withMutation<T>(fn): T

Type Parameters

T

Parameters

fn

Returns

T

Implementation of

IUnionSchema.withMutation

Inherited from

Schema.withMutation

Defined in

node_modules/.pnpm/yup@1.4.0/node_modules/yup/index.d.ts:183

ON THIS PAGE