title: Core.z. Zod Type

A2A Node SDK - v0.1.0 / Modules / Core / z / ZodType

Class: ZodType<Output, Def, Input>

Core.z.ZodType

Type parameters

NameType
Outputany
Defextends ZodTypeDef = ZodTypeDef
InputOutput

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new ZodType<Output, Def, Input>(def): ZodType<Output, Def, Input>

Type parameters

NameType
Outputany
Defextends ZodTypeDef = ZodTypeDef
InputOutput

Parameters

NameType
defDef

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
NameType
dataunknown
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

NameType
inputParseInput
ctx?ParseContext

Returns

ParseContext


_getType

_getType(input): string

Parameters

NameType
inputParseInput

Returns

string


_parse

_parse(input): ParseReturnType<Output>

Parameters

NameType
inputParseInput

Returns

ParseReturnType<Output>


_parseAsync

_parseAsync(input): AsyncParseReturnType<Output>

Parameters

NameType
inputParseInput

Returns

AsyncParseReturnType<Output>


_parseSync

_parseSync(input): SyncParseReturnType<Output>

Parameters

NameType
inputParseInput

Returns

SyncParseReturnType<Output>


_processInputParams

_processInputParams(input): Object

Parameters

NameType
inputParseInput

Returns

Object

NameType
ctxParseContext
statusParseStatus

_refinement

_refinement(refinement): ZodEffects<ZodType<Output, Def, Input>, Output, Input>

Parameters

NameType
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

NameType
Textends ZodTypeAny

Parameters

NameType
incomingT

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

NameType
Bextends string | number | symbol

Parameters

NameType
brand?B

Returns

ZodBranded<ZodType<Output, Def, Input>, B>


catch

catch(def): ZodCatch<ZodType<Output, Def, Input>>

Parameters

NameType
defOutput

Returns

ZodCatch<ZodType<Output, Def, Input>>

catch(def): ZodCatch<ZodType<Output, Def, Input>>

Parameters

NameType
def(ctx: { error: ZodError<any> ; input: Input }) => Output

Returns

ZodCatch<ZodType<Output, Def, Input>>


default

default(def): ZodDefault<ZodType<Output, Def, Input>>

Parameters

NameType
defnoUndefined<Input>

Returns

ZodDefault<ZodType<Output, Def, Input>>

default(def): ZodDefault<ZodType<Output, Def, Input>>

Parameters

NameType
def() => noUndefined<Input>

Returns

ZodDefault<ZodType<Output, Def, Input>>


describe

describe(description): this

Parameters

NameType
descriptionstring

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

NameType
Textends ZodTypeAny

Parameters

NameType
optionT

Returns

ZodUnion<[ZodType<Output, Def, Input>, T]>


parse

parse(data, params?): Output

Parameters

NameType
dataunknown
params?InexactPartial<ParseParams>

Returns

Output


parseAsync

parseAsync(data, params?): Promise<Output>

Parameters

NameType
dataunknown
params?InexactPartial<ParseParams>

Returns

Promise<Output>


pipe

pipe<T>(target): ZodPipeline<ZodType<Output, Def, Input>, T>

Type parameters

NameType
Textends ZodTypeAny

Parameters

NameType
targetT

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

NameType
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

NameType
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

NameType
check(arg: Output) => arg is RefinedOutput
refinementDataIssueData | (arg: Output, ctx: RefinementCtx) => IssueData

Returns

ZodEffects<ZodType<Output, Def, Input>, RefinedOutput, Input>

refinement(check, refinementData): ZodEffects<ZodType<Output, Def, Input>, Output, Input>

Parameters

NameType
check(arg: Output) => boolean
refinementDataIssueData | (arg: Output, ctx: RefinementCtx) => IssueData

Returns

ZodEffects<ZodType<Output, Def, Input>, Output, Input>


safeParse

safeParse(data, params?): SafeParseReturnType<Input, Output>

Parameters

NameType
dataunknown
params?InexactPartial<ParseParams>

Returns

SafeParseReturnType<Input, Output>


safeParseAsync

safeParseAsync(data, params?): Promise<SafeParseReturnType<Input, Output>>

Parameters

NameType
dataunknown
params?InexactPartial<ParseParams>

Returns

Promise<SafeParseReturnType<Input, Output>>


superRefine

superRefine<RefinedOutput>(refinement): ZodEffects<ZodType<Output, Def, Input>, RefinedOutput, Input>

Type parameters

Name
RefinedOutput

Parameters

NameType
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

NameType
refinement(arg: Output, ctx: RefinementCtx) => void

Returns

ZodEffects<ZodType<Output, Def, Input>, Output, Input>

superRefine(refinement): ZodEffects<ZodType<Output, Def, Input>, Output, Input>

Parameters

NameType
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

NameType
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

NameType
dataunknown

Returns

Result<Output> | Promise<Result<Output>>