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