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