title: Core.z. Zod Union
A2A Node SDK - v0.1.0 / Modules / Core / z / ZodUnion
Class: ZodUnion<T>
Type parameters
Name | Type |
---|---|
T | extends ZodUnionOptions |
Hierarchy
-
ZodType
<T
[number
]["_output"
],ZodUnionDef
<T
>,T
[number
]["_input"
]>↳
ZodUnion
Table of contents
Constructors
Properties
Accessors
Methods
- _getOrReturnCtx
- _getType
- _parse
- _parseAsync
- _parseSync
- _processInputParams
- _refinement
- and
- array
- brand
- catch
- default
- describe
- isNullable
- isOptional
- nullable
- nullish
- optional
- or
- parse
- parseAsync
- pipe
- promise
- readonly
- refine
- refinement
- safeParse
- safeParseAsync
- superRefine
- transform
- ~validate
Constructors
constructor
• new ZodUnion<T
>(def
): ZodUnion
<T
>
Type parameters
Name | Type |
---|---|
T | extends readonly [ZodTypeAny , ZodTypeAny ] |
Parameters
Name | Type |
---|---|
def | ZodUnionDef <T > |
Returns
ZodUnion
<T
>
Inherited from
Properties
_def
• Readonly
_def: ZodUnionDef
<T
>
Inherited from
_input
• Readonly
_input: T
[number
]["_input"
]
Inherited from
_output
• Readonly
_output: T
[number
]["_output"
]
Inherited from
_type
• Readonly
_type: T
[number
]["_output"
]
Inherited from
create
▪ Static
create: <Options>(types
: Options
, params?
: RawCreateParams
) => ZodUnion
<Options
>
Type declaration
▸ <Options
>(types
, params?
): ZodUnion
<Options
>
Type parameters
Name | Type |
---|---|
Options | extends readonly [ZodTypeAny , ZodTypeAny , ZodTypeAny ] |
Parameters
Name | Type |
---|---|
types | Options |
params? | RawCreateParams |
Returns
ZodUnion
<Options
>
spa
• spa: (data
: unknown
, params?
: InexactPartial
<ParseParams
>) => Promise
<SafeParseReturnType
<T
[number
]["_input"
], T
[number
]["_output"
]>>
Alias of safeParseAsync
Type declaration
▸ (data
, params?
): Promise
<SafeParseReturnType
<T
[number
]["_input"
], T
[number
]["_output"
]>>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<SafeParseReturnType
<T
[number
]["_input"
], T
[number
]["_output"
]>>
Inherited from
~standard
• ~standard: Props
<T
[number
]["_input"
], T
[number
]["_output"
]>
Inherited from
Accessors
description
• get
description(): undefined
| string
Returns
undefined
| string
Inherited from
ZodType.description
options
• get
options(): T
Returns
T
Methods
_getOrReturnCtx
▸ _getOrReturnCtx(input
, ctx?
): ParseContext
Parameters
Name | Type |
---|---|
input | ParseInput |
ctx? | ParseContext |
Returns
Inherited from
_getType
▸ _getType(input
): string
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
string
Inherited from
_parse
▸ _parse(input
): ParseReturnType
<T
[number
]["_output"
]>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
ParseReturnType
<T
[number
]["_output"
]>
Overrides
_parseAsync
▸ _parseAsync(input
): AsyncParseReturnType
<T
[number
]["_output"
]>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
AsyncParseReturnType
<T
[number
]["_output"
]>
Inherited from
_parseSync
▸ _parseSync(input
): SyncParseReturnType
<T
[number
]["_output"
]>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
SyncParseReturnType
<T
[number
]["_output"
]>
Inherited from
_processInputParams
▸ _processInputParams(input
): Object
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
Object
Name | Type |
---|---|
ctx | ParseContext |
status | ParseStatus |
Inherited from
_refinement
▸ _refinement(refinement
): ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Parameters
Name | Type |
---|---|
refinement | (arg : T [number ]["_output" ], ctx : RefinementCtx ) => any |
Returns
ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Inherited from
and
▸ and<T
>(incoming
): ZodIntersection
<ZodUnion
<T
>, T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
incoming | T |
Returns
ZodIntersection
<ZodUnion
<T
>, T
>
Inherited from
array
▸ array(): ZodArray
<ZodUnion
<T
>, "many"
>
Returns
Inherited from
brand
▸ brand<B
>(brand?
): ZodBranded
<ZodUnion
<T
>, B
>
Type parameters
Name | Type |
---|---|
B | extends string | number | symbol |
Parameters
Name | Type |
---|---|
brand? | B |
Returns
ZodBranded
<ZodUnion
<T
>, B
>
Inherited from
catch
▸ catch(def
): ZodCatch
<ZodUnion
<T
>>
Parameters
Name | Type |
---|---|
def | T [number ]["_output" ] |
Returns
Inherited from
▸ catch(def
): ZodCatch
<ZodUnion
<T
>>
Parameters
Name | Type |
---|---|
def | (ctx : { error : ZodError <any > ; input : T [number ]["_input" ] }) => T [number ]["_output" ] |
Returns
Inherited from
default
▸ default(def
): ZodDefault
<ZodUnion
<T
>>
Parameters
Name | Type |
---|---|
def | noUndefined <T [number ]["_input" ]> |
Returns
ZodDefault
<ZodUnion
<T
>>
Inherited from
▸ default(def
): ZodDefault
<ZodUnion
<T
>>
Parameters
Name | Type |
---|---|
def | () => noUndefined <T [number ]["_input" ]> |
Returns
ZodDefault
<ZodUnion
<T
>>
Inherited from
describe
▸ describe(description
): this
Parameters
Name | Type |
---|---|
description | string |
Returns
this
Inherited from
isNullable
▸ isNullable(): boolean
Returns
boolean
Inherited from
isOptional
▸ isOptional(): boolean
Returns
boolean
Inherited from
nullable
▸ nullable(): ZodNullable
<ZodUnion
<T
>>
Returns
ZodNullable
<ZodUnion
<T
>>
Inherited from
nullish
▸ nullish(): ZodOptional
<ZodNullable
<ZodUnion
<T
>>>
Returns
ZodOptional
<ZodNullable
<ZodUnion
<T
>>>
Inherited from
optional
▸ optional(): ZodOptional
<ZodUnion
<T
>>
Returns
ZodOptional
<ZodUnion
<T
>>
Inherited from
or
▸ or<T
>(option
): ZodUnion
<[ZodUnion
<T
>, T
]>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
option | T |
Returns
Inherited from
parse
▸ parse(data
, params?
): T
[number
]["_output"
]
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
T
[number
]["_output"
]
Inherited from
parseAsync
▸ parseAsync(data
, params?
): Promise
<T
[number
]["_output"
]>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<T
[number
]["_output"
]>
Inherited from
pipe
▸ pipe<T
>(target
): ZodPipeline
<ZodUnion
<T
>, T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
target | T |
Returns
ZodPipeline
<ZodUnion
<T
>, T
>
Inherited from
promise
▸ promise(): ZodPromise
<ZodUnion
<T
>>
Returns
ZodPromise
<ZodUnion
<T
>>
Inherited from
readonly
▸ readonly(): ZodReadonly
<ZodUnion
<T
>>
Returns
ZodReadonly
<ZodUnion
<T
>>
Inherited from
refine
▸ refine<RefinedOutput
>(check
, message?
): ZodEffects
<ZodUnion
<T
>, RefinedOutput
, T
[number
]["_input"
]>
Type parameters
Name | Type |
---|---|
RefinedOutput | extends any |
Parameters
Name | Type |
---|---|
check | (arg : T [number ]["_output" ]) => arg is RefinedOutput |
message? | string | Partial <Omit <ZodCustomIssue , "code" >> | (arg : T [number ]["_output" ]) => Partial <Omit <ZodCustomIssue , "code" >> |
Returns
ZodEffects
<ZodUnion
<T
>, RefinedOutput
, T
[number
]["_input"
]>
Inherited from
▸ refine(check
, message?
): ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Parameters
Name | Type |
---|---|
check | (arg : T [number ]["_output" ]) => unknown |
message? | string | Partial <Omit <ZodCustomIssue , "code" >> | (arg : T [number ]["_output" ]) => Partial <Omit <ZodCustomIssue , "code" >> |
Returns
ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Inherited from
refinement
▸ refinement<RefinedOutput
>(check
, refinementData
): ZodEffects
<ZodUnion
<T
>, RefinedOutput
, T
[number
]["_input"
]>
Type parameters
Name | Type |
---|---|
RefinedOutput | extends any |
Parameters
Name | Type |
---|---|
check | (arg : T [number ]["_output" ]) => arg is RefinedOutput |
refinementData | IssueData | (arg : T [number ]["_output" ], ctx : RefinementCtx ) => IssueData |
Returns
ZodEffects
<ZodUnion
<T
>, RefinedOutput
, T
[number
]["_input"
]>
Inherited from
▸ refinement(check
, refinementData
): ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Parameters
Name | Type |
---|---|
check | (arg : T [number ]["_output" ]) => boolean |
refinementData | IssueData | (arg : T [number ]["_output" ], ctx : RefinementCtx ) => IssueData |
Returns
ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Inherited from
safeParse
▸ safeParse(data
, params?
): SafeParseReturnType
<T
[number
]["_input"
], T
[number
]["_output"
]>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
SafeParseReturnType
<T
[number
]["_input"
], T
[number
]["_output"
]>
Inherited from
safeParseAsync
▸ safeParseAsync(data
, params?
): Promise
<SafeParseReturnType
<T
[number
]["_input"
], T
[number
]["_output"
]>>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<SafeParseReturnType
<T
[number
]["_input"
], T
[number
]["_output"
]>>
Inherited from
superRefine
▸ superRefine<RefinedOutput
>(refinement
): ZodEffects
<ZodUnion
<T
>, RefinedOutput
, T
[number
]["_input"
]>
Type parameters
Name | Type |
---|---|
RefinedOutput | extends any |
Parameters
Name | Type |
---|---|
refinement | (arg : T [number ]["_output" ], ctx : RefinementCtx ) => arg is RefinedOutput |
Returns
ZodEffects
<ZodUnion
<T
>, RefinedOutput
, T
[number
]["_input"
]>
Inherited from
▸ superRefine(refinement
): ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Parameters
Name | Type |
---|---|
refinement | (arg : T [number ]["_output" ], ctx : RefinementCtx ) => void |
Returns
ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Inherited from
▸ superRefine(refinement
): ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Parameters
Name | Type |
---|---|
refinement | (arg : T [number ]["_output" ], ctx : RefinementCtx ) => Promise <void > |
Returns
ZodEffects
<ZodUnion
<T
>, T
[number
]["_output"
], T
[number
]["_input"
]>
Inherited from
transform
▸ transform<NewOut
>(transform
): ZodEffects
<ZodUnion
<T
>, NewOut
, T
[number
]["_input"
]>
Type parameters
Name |
---|
NewOut |
Parameters
Name | Type |
---|---|
transform | (arg : T [number ]["_output" ], ctx : RefinementCtx ) => NewOut | Promise <NewOut > |
Returns
ZodEffects
<ZodUnion
<T
>, NewOut
, T
[number
]["_input"
]>
Inherited from
~validate
▸ ~validate(data
): Result
<T
[number
]["_output"
]> | Promise
<Result
<T
[number
]["_output"
]>>
Parameters
Name | Type |
---|---|
data | unknown |
Returns
Result
<T
[number
]["_output"
]> | Promise
<Result
<T
[number
]["_output"
]>>