Appearance
Function: xor()
ts
function xor<T>(options: T, params?:
| string
| {
error?: string | $ZodErrorMap<NonNullable<$ZodIssueInvalidUnion>>;
message?: string;
inclusive?: boolean;
}): ZodXor<T>;Defined in: node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.d.cts:486
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
| Type Parameter |
|---|
T extends readonly SomeType[] |
Parameters
| Parameter | Type |
|---|---|
options | T |
params? | | string | { error?: string | $ZodErrorMap<NonNullable<$ZodIssueInvalidUnion>>; message?: string; inclusive?: boolean; } |
Returns
ZodXor<T>