Skip to main content

Function: xor()

xor<T>(options, params?): ZodXor<T>

Defined in: packages/agentos/node_modules/zod/v4/classic/schemas.d.cts:547

Creates an exclusive union (XOR) where exactly one option must match. Unlike regular unions that succeed when any option matches, xor fails if zero or more than one option matches the input.

Type Parameters​

T​

T extends readonly SomeType[]

Parameters​

options​

T

params?​

string |

{ error?: string | $ZodErrorMap<NonNullable<$ZodIssueInvalidUnion>>; inclusive?: boolean; message?: string; }

error?​

string | $ZodErrorMap<NonNullable<$ZodIssueInvalidUnion>>

inclusive?​

boolean

message?​

string

Deprecated

This parameter is deprecated. Use error instead.

Returns​

ZodXor<T>