title: Core.z
A2A Node SDK - v0.1.0 / Modules / Core / z
Namespace: z
Core.z
Re-export Zod for schema validation
Remarks
Exported explicitly to avoid conflicts
Table of contents
References
Namespaces
Enumerations
Classes
- ParseStatus
- ZodAny
- ZodArray
- ZodBigInt
- ZodBoolean
- ZodBranded
- ZodCatch
- ZodDate
- ZodDefault
- ZodDiscriminatedUnion
- ZodEffects
- ZodEnum
- ZodError
- ZodFunction
- ZodIntersection
- ZodLazy
- ZodLiteral
- ZodMap
- ZodNaN
- ZodNativeEnum
- ZodNever
- ZodNull
- ZodNullable
- ZodNumber
- ZodObject
- ZodOptional
- ZodPipeline
- ZodPromise
- ZodReadonly
- ZodRecord
- ZodSet
- ZodString
- ZodSymbol
- ZodTuple
- ZodType
- ZodUndefined
- ZodUnion
- ZodUnknown
- ZodVoid
Interfaces
- ParseContext
- ParseResult
- RefinementCtx
- ZodAnyDef
- ZodArrayDef
- ZodBigIntDef
- ZodBooleanDef
- ZodBrandedDef
- ZodCatchDef
- ZodCustomIssue
- ZodDateDef
- ZodDefaultDef
- ZodDiscriminatedUnionDef
- ZodEffectsDef
- ZodEnumDef
- ZodFunctionDef
- ZodIntersectionDef
- ZodInvalidArgumentsIssue
- ZodInvalidDateIssue
- ZodInvalidEnumValueIssue
- ZodInvalidIntersectionTypesIssue
- ZodInvalidLiteralIssue
- ZodInvalidReturnTypeIssue
- ZodInvalidStringIssue
- ZodInvalidTypeIssue
- ZodInvalidUnionDiscriminatorIssue
- ZodInvalidUnionIssue
- ZodLazyDef
- ZodLiteralDef
- ZodMapDef
- ZodNaNDef
- ZodNativeEnumDef
- ZodNeverDef
- ZodNotFiniteIssue
- ZodNotMultipleOfIssue
- ZodNullDef
- ZodNullableDef
- ZodNumberDef
- ZodObjectDef
- ZodOptionalDef
- ZodPipelineDef
- ZodPromiseDef
- ZodReadonlyDef
- ZodRecordDef
- ZodSetDef
- ZodStringDef
- ZodSymbolDef
- ZodTooBigIssue
- ZodTooSmallIssue
- ZodTupleDef
- ZodTypeDef
- ZodUndefinedDef
- ZodUnionDef
- ZodUnknownDef
- ZodUnrecognizedKeysIssue
- ZodVoidDef
Type Aliases
- AnyZodObject
- AnyZodTuple
- ArrayCardinality
- ArrayKeys
- AssertArray
- AsyncParseReturnType
- BRAND
- CatchallInput
- CatchallOutput
- CustomErrorParams
- DIRTY
- DenormalizedError
- Effect
- EnumLike
- EnumValues
- ErrorMapCtx
- FilterEnum
- INVALID
- Indices
- InnerTypeOfFunction
- InputTypeOfTuple
- InputTypeOfTupleWithRest
- IpVersion
- IssueData
- KeySchema
- OK
- ObjectPair
- OuterTypeOfFunction
- OutputTypeOfTuple
- OutputTypeOfTupleWithRest
- ParseInput
- ParseParams
- ParsePath
- ParsePathComponent
- ParseReturnType
- PassthroughType
- PreprocessEffect
- Primitive
- ProcessedCreateParams
- RawCreateParams
- RecordType
- Refinement
- RefinementEffect
- SafeParseError
- SafeParseReturnType
- SafeParseSuccess
- Scalars
- SomeZodObject
- StringValidation
- SuperRefinement
- SyncParseReturnType
- TransformEffect
- TypeOf
- UnknownKeysParam
- Values
- Writeable
- ZodBigIntCheck
- ZodDateCheck
- ZodDiscriminatedUnionOption
- ZodErrorMap
- ZodFirstPartySchemaTypes
- ZodFormattedError
- ZodIssue
- ZodIssueBase
- ZodIssueCode
- ZodIssueOptionalMessage
- ZodNonEmptyArray
- ZodNullableType
- ZodNumberCheck
- ZodOptionalType
- ZodParsedType
- ZodRawShape
- ZodStringCheck
- ZodTupleItems
- ZodTypeAny
- ZodUnionOptions
- arrayOutputType
- baseObjectInputType
- baseObjectOutputType
- deoptional
- inferFlattenedErrors
- inferFormattedError
- input
- mergeTypes
- noUnrecognized
- objectInputType
- objectOutputType
- output
- typeToFlattenedError
- typecast
Variables
Functions
- DIRTY
- OK
- addIssueToContext
- any
- array
- bigint
- boolean
- custom
- date
- datetimeRegex
- defaultErrorMap
- discriminatedUnion
- effect
- enum
- function
- getErrorMap
- getParsedType
- instanceof
- intersection
- isAborted
- isAsync
- isDirty
- isValid
- lazy
- literal
- makeIssue
- map
- nan
- nativeEnum
- never
- null
- nullable
- number
- object
- oboolean
- onumber
- optional
- ostring
- pipeline
- preprocess
- promise
- quotelessJson
- record
- set
- setErrorMap
- strictObject
- string
- symbol
- tuple
- undefined
- union
- unknown
- void
References
Schema
Renames and re-exports ZodType
ZodSchema
Renames and re-exports ZodType
ZodTransformer
Renames and re-exports ZodEffects
infer
Renames and re-exports TypeOf
transformer
Renames and re-exports effect
Type Aliases
AnyZodObject
Ƭ AnyZodObject: ZodObject
<any
, any
, any
>
AnyZodTuple
Ƭ AnyZodTuple: ZodTuple
<[ZodTypeAny
, …ZodTypeAny[]] | [], ZodTypeAny
| null
>
ArrayCardinality
Ƭ ArrayCardinality: "many"
| "atleastone"
ArrayKeys
Ƭ ArrayKeys: keyof any
[]
AssertArray
Ƭ AssertArray<T
>: T
extends any
[] ? T
: never
Type parameters
Name |
---|
T |
AsyncParseReturnType
Ƭ AsyncParseReturnType<T
>: Promise
<SyncParseReturnType
<T
>>
Type parameters
Name |
---|
T |
BRAND
Ƭ BRAND<T
>: Object
Type parameters
Name | Type |
---|---|
T | extends string | number | symbol |
Type declaration
Name | Type |
---|---|
[BRAND] | { [k in T]: true } |
CatchallInput
Ƭ CatchallInput<T
>: ZodType
extends T
? unknown
: { [k: string]
: T
["_input"
]; }
Type parameters
Name | Type |
---|---|
T | extends ZodType |
CatchallOutput
Ƭ CatchallOutput<T
>: ZodType
extends T
? unknown
: { [k: string]
: T
["_output"
]; }
Type parameters
Name | Type |
---|---|
T | extends ZodType |
CustomErrorParams
Ƭ CustomErrorParams: Partial
<Omit
<ZodCustomIssue
, "code"
>>
DIRTY
Ƭ DIRTY<T
>: Object
Type parameters
Name |
---|
T |
Type declaration
Name | Type |
---|---|
status | "dirty" |
value | T |
DenormalizedError
Ƭ DenormalizedError: Object
Index signature
▪ [k: string
]: DenormalizedError
| string
[]
Effect
Ƭ Effect<T
>: RefinementEffect
<T
> | TransformEffect
<T
> | PreprocessEffect
<T
>
Type parameters
Name |
---|
T |
EnumLike
Ƭ EnumLike: Object
Index signature
▪ [k: string
]: string
| number
EnumValues
Ƭ EnumValues<T
>: readonly [T
, …T[]]
Type parameters
Name | Type |
---|---|
T | extends string = string |
ErrorMapCtx
Ƭ ErrorMapCtx: Object
Type declaration
Name | Type |
---|---|
data | any |
defaultError | string |
FilterEnum
Ƭ FilterEnum<Values
, ToExclude
>: Values
extends [] ? [] : Values
extends [infer Head, …(infer Rest)] ? Head
extends ToExclude
? FilterEnum
<Rest
, ToExclude
> : [Head
, …FilterEnum<Rest, ToExclude>] : never
Type parameters
Name |
---|
Values |
ToExclude |
INVALID
Ƭ INVALID: Object
Type declaration
Name | Type |
---|---|
status | "aborted" |
Indices
Ƭ Indices<T
>: Exclude
<keyof T
, ArrayKeys
>
Type parameters
Name |
---|
T |
InnerTypeOfFunction
Ƭ InnerTypeOfFunction<Args
, Returns
>: Args
["_output"
] extends any
[] ? (…args
: Args
["_output"
]) => Returns
["_input"
] : never
Type parameters
Name | Type |
---|---|
Args | extends ZodTuple <any , any > |
Returns | extends ZodTypeAny |
InputTypeOfTuple
Ƭ InputTypeOfTuple<T
>: AssertArray
<{ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k][“_input”] : never }>
Type parameters
Name | Type |
---|---|
T | extends ZodTupleItems | [] |
InputTypeOfTupleWithRest
Ƭ InputTypeOfTupleWithRest<T
, Rest
>: Rest
extends ZodTypeAny
? […InputTypeOfTuple<T>, …Rest[“_input”][]] : InputTypeOfTuple
<T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTupleItems | [] |
Rest | extends ZodTypeAny | null = null |
IpVersion
Ƭ IpVersion: "v4"
| "v6"
IssueData
Ƭ IssueData: stripPath
<ZodIssueOptionalMessage
> & { fatal?
: boolean
; path?
: (string
| number
)[] }
KeySchema
Ƭ KeySchema: ZodType
<string
| number
| symbol
, any
, any
>
OK
Ƭ OK<T
>: Object
Type parameters
Name |
---|
T |
Type declaration
Name | Type |
---|---|
status | "valid" |
value | T |
ObjectPair
Ƭ ObjectPair: Object
Type declaration
Name | Type |
---|---|
key | SyncParseReturnType <any > |
value | SyncParseReturnType <any > |
OuterTypeOfFunction
Ƭ OuterTypeOfFunction<Args
, Returns
>: Args
["_input"
] extends any
[] ? (…args
: Args
["_input"
]) => Returns
["_output"
] : never
Type parameters
Name | Type |
---|---|
Args | extends ZodTuple <any , any > |
Returns | extends ZodTypeAny |
OutputTypeOfTuple
Ƭ OutputTypeOfTuple<T
>: AssertArray
<{ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k][“_output”] : never }>
Type parameters
Name | Type |
---|---|
T | extends ZodTupleItems | [] |
OutputTypeOfTupleWithRest
Ƭ OutputTypeOfTupleWithRest<T
, Rest
>: Rest
extends ZodTypeAny
? […OutputTypeOfTuple<T>, …Rest[“_output”][]] : OutputTypeOfTuple
<T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTupleItems | [] |
Rest | extends ZodTypeAny | null = null |
ParseInput
Ƭ ParseInput: Object
Type declaration
Name | Type |
---|---|
data | any |
parent | ParseContext |
path | (string | number )[] |
ParseParams
Ƭ ParseParams: Object
Type declaration
Name | Type |
---|---|
async | boolean |
errorMap | ZodErrorMap |
path | (string | number )[] |
ParsePath
Ƭ ParsePath: ParsePathComponent
[]
ParsePathComponent
Ƭ ParsePathComponent: string
| number
ParseReturnType
Ƭ ParseReturnType<T
>: SyncParseReturnType
<T
> | AsyncParseReturnType
<T
>
Type parameters
Name |
---|
T |
PassthroughType
Ƭ PassthroughType<T
>: T
extends "passthrough"
? { [k: string]
: unknown
; } : unknown
Type parameters
Name | Type |
---|---|
T | extends UnknownKeysParam |
PreprocessEffect
Ƭ PreprocessEffect<T
>: Object
Type parameters
Name |
---|
T |
Type declaration
Name | Type |
---|---|
transform | (arg : T , ctx : RefinementCtx ) => any |
type | "preprocess" |
Primitive
Ƭ Primitive: string
| number
| symbol
| bigint
| boolean
| null
| undefined
ProcessedCreateParams
Ƭ ProcessedCreateParams: Object
Type declaration
Name | Type |
---|---|
description? | string |
errorMap? | ZodErrorMap |
RawCreateParams
Ƭ RawCreateParams: { description?
: string
; errorMap?
: ZodErrorMap
; invalid_type_error?
: string
; message?
: string
; required_error?
: string
} | undefined
RecordType
Ƭ RecordType<K
, V
>: [string
] extends [K
] ? Record
<K
, V
> : [number
] extends [K
] ? Record
<K
, V
> : [symbol
] extends [K
] ? Record
<K
, V
> : [BRAND
<string
| number
| symbol
>] extends [K
] ? Record
<K
, V
> : Partial
<Record
<K
, V
>>
Type parameters
Name | Type |
---|---|
K | extends string | number | symbol |
V | V |
Refinement
Ƭ Refinement<T
>: (arg
: T
, ctx
: RefinementCtx
) => any
Type parameters
Name |
---|
T |
Type declaration
▸ (arg
, ctx
): any
Parameters
Name | Type |
---|---|
arg | T |
ctx | RefinementCtx |
Returns
any
RefinementEffect
Ƭ RefinementEffect<T
>: Object
Type parameters
Name |
---|
T |
Type declaration
Name | Type |
---|---|
refinement | (arg : T , ctx : RefinementCtx ) => any |
type | "refinement" |
SafeParseError
Ƭ SafeParseError<Input
>: Object
Type parameters
Name |
---|
Input |
Type declaration
Name | Type |
---|---|
data? | never |
error | ZodError <Input > |
success | false |
SafeParseReturnType
Ƭ SafeParseReturnType<Input
, Output
>: SafeParseSuccess
<Output
> | SafeParseError
<Input
>
Type parameters
Name |
---|
Input |
Output |
SafeParseSuccess
Ƭ SafeParseSuccess<Output
>: Object
Type parameters
Name |
---|
Output |
Type declaration
Name | Type |
---|---|
data | Output |
error? | never |
success | true |
Scalars
Ƭ Scalars: Primitive
| Primitive
[]
SomeZodObject
Ƭ SomeZodObject: ZodObject
<ZodRawShape
, UnknownKeysParam
, ZodTypeAny
>
StringValidation
Ƭ StringValidation: "email"
| "url"
| "emoji"
| "uuid"
| "nanoid"
| "regex"
| "cuid"
| "cuid2"
| "ulid"
| "datetime"
| "date"
| "time"
| "duration"
| "ip"
| "cidr"
| "base64"
| "jwt"
| "base64url"
| { includes
: string
; position?
: number
} | { startsWith
: string
} | { endsWith
: string
}
SuperRefinement
Ƭ SuperRefinement<T
>: (arg
: T
, ctx
: RefinementCtx
) => void
| Promise
<void
>
Type parameters
Name |
---|
T |
Type declaration
▸ (arg
, ctx
): void
| Promise
<void
>
Parameters
Name | Type |
---|---|
arg | T |
ctx | RefinementCtx |
Returns
void
| Promise
<void
>
SyncParseReturnType
Ƭ SyncParseReturnType<T
>: OK
<T
> | DIRTY
<T
> | INVALID
Type parameters
Name | Type |
---|---|
T | any |
TransformEffect
Ƭ TransformEffect<T
>: Object
Type parameters
Name |
---|
T |
Type declaration
Name | Type |
---|---|
transform | (arg : T , ctx : RefinementCtx ) => any |
type | "transform" |
TypeOf
Ƭ TypeOf<T
>: T
["_output"
]
Type parameters
Name | Type |
---|---|
T | extends ZodType <any , any , any > |
UnknownKeysParam
Ƭ UnknownKeysParam: "passthrough"
| "strict"
| "strip"
Values
Ƭ Values<T
>: { [k in T[number]]: k }
Type parameters
Name | Type |
---|---|
T | extends EnumValues |
Writeable
Ƭ Writeable<T
>: { -readonly [P in keyof T]: T[P] }
Type parameters
Name |
---|
T |
ZodBigIntCheck
Ƭ ZodBigIntCheck: { inclusive
: boolean
; kind
: "min"
; message?
: string
; value
: bigint
} | { inclusive
: boolean
; kind
: "max"
; message?
: string
; value
: bigint
} | { kind
: "multipleOf"
; message?
: string
; value
: bigint
}
ZodDateCheck
Ƭ ZodDateCheck: { kind
: "min"
; message?
: string
; value
: number
} | { kind
: "max"
; message?
: string
; value
: number
}
ZodDiscriminatedUnionOption
Ƭ ZodDiscriminatedUnionOption<Discriminator
>: ZodObject
<{ [key in Discriminator]: ZodTypeAny } & ZodRawShape
, UnknownKeysParam
, ZodTypeAny
>
Type parameters
Name | Type |
---|---|
Discriminator | extends string |
ZodErrorMap
Ƭ ZodErrorMap: (issue
: ZodIssueOptionalMessage
, _ctx
: ErrorMapCtx
) => { message
: string
}
Type declaration
▸ (issue
, _ctx
): Object
Parameters
Name | Type |
---|---|
issue | ZodIssueOptionalMessage |
_ctx | ErrorMapCtx |
Returns
Object
Name | Type |
---|---|
message | string |
ZodFirstPartySchemaTypes
Ƭ ZodFirstPartySchemaTypes: ZodString
| ZodNumber
| ZodNaN
| ZodBigInt
| ZodBoolean
| ZodDate
| ZodUndefined
| ZodNull
| ZodAny
| ZodUnknown
| ZodNever
| ZodVoid
| ZodArray
<any
, any
> | ZodObject
<any
, any
, any
> | ZodUnion
<any
> | ZodDiscriminatedUnion
<any
, any
> | ZodIntersection
<any
, any
> | ZodTuple
<any
, any
> | ZodRecord
<any
, any
> | ZodMap
<any
> | ZodSet
<any
> | ZodFunction
<any
, any
> | ZodLazy
<any
> | ZodLiteral
<any
> | ZodEnum
<any
> | ZodEffects
<any
, any
, any
> | ZodNativeEnum
<any
> | ZodOptional
<any
> | ZodNullable
<any
> | ZodDefault
<any
> | ZodCatch
<any
> | ZodPromise
<any
> | ZodBranded
<any
, any
> | ZodPipeline
<any
, any
> | ZodReadonly
<any
> | ZodSymbol
ZodFormattedError
Ƭ ZodFormattedError<T
, U
>: { _errors
: U
[] } & recursiveZodFormattedError
<NonNullable
<T
>>
Type parameters
Name | Type |
---|---|
T | T |
U | string |
ZodIssue
Ƭ ZodIssue: ZodIssueOptionalMessage
& { fatal?
: boolean
; message
: string
}
ZodIssueBase
Ƭ ZodIssueBase: Object
Type declaration
Name | Type |
---|---|
message? | string |
path | (string | number )[] |
ZodIssueCode
Ƭ ZodIssueCode: keyof typeof ZodIssueCode
ZodIssueOptionalMessage
Ƭ ZodIssueOptionalMessage: ZodInvalidTypeIssue
| ZodInvalidLiteralIssue
| ZodUnrecognizedKeysIssue
| ZodInvalidUnionIssue
| ZodInvalidUnionDiscriminatorIssue
| ZodInvalidEnumValueIssue
| ZodInvalidArgumentsIssue
| ZodInvalidReturnTypeIssue
| ZodInvalidDateIssue
| ZodInvalidStringIssue
| ZodTooSmallIssue
| ZodTooBigIssue
| ZodInvalidIntersectionTypesIssue
| ZodNotMultipleOfIssue
| ZodNotFiniteIssue
| ZodCustomIssue
ZodNonEmptyArray
Ƭ ZodNonEmptyArray<T
>: ZodArray
<T
, "atleastone"
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
ZodNullableType
Ƭ ZodNullableType<T
>: ZodNullable
<T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
ZodNumberCheck
Ƭ ZodNumberCheck: { inclusive
: boolean
; kind
: "min"
; message?
: string
; value
: number
} | { inclusive
: boolean
; kind
: "max"
; message?
: string
; value
: number
} | { kind
: "int"
; message?
: string
} | { kind
: "multipleOf"
; message?
: string
; value
: number
} | { kind
: "finite"
; message?
: string
}
ZodOptionalType
Ƭ ZodOptionalType<T
>: ZodOptional
<T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
ZodParsedType
Ƭ ZodParsedType: keyof typeof ZodParsedType
ZodRawShape
Ƭ ZodRawShape: Object
Index signature
▪ [k: string
]: ZodTypeAny
ZodStringCheck
Ƭ ZodStringCheck: { kind
: "min"
; message?
: string
; value
: number
} | { kind
: "max"
; message?
: string
; value
: number
} | { kind
: "length"
; message?
: string
; value
: number
} | { kind
: "email"
; message?
: string
} | { kind
: "url"
; message?
: string
} | { kind
: "emoji"
; message?
: string
} | { kind
: "uuid"
; message?
: string
} | { kind
: "nanoid"
; message?
: string
} | { kind
: "cuid"
; message?
: string
} | { kind
: "includes"
; message?
: string
; position?
: number
; value
: string
} | { kind
: "cuid2"
; message?
: string
} | { kind
: "ulid"
; message?
: string
} | { kind
: "startsWith"
; message?
: string
; value
: string
} | { kind
: "endsWith"
; message?
: string
; value
: string
} | { kind
: "regex"
; message?
: string
; regex
: RegExp
} | { kind
: "trim"
; message?
: string
} | { kind
: "toLowerCase"
; message?
: string
} | { kind
: "toUpperCase"
; message?
: string
} | { alg?
: string
; kind
: "jwt"
; message?
: string
} | { kind
: "datetime"
; local
: boolean
; message?
: string
; offset
: boolean
; precision
: number
| null
} | { kind
: "date"
; message?
: string
} | { kind
: "time"
; message?
: string
; precision
: number
| null
} | { kind
: "duration"
; message?
: string
} | { kind
: "ip"
; message?
: string
; version?
: IpVersion
} | { kind
: "cidr"
; message?
: string
; version?
: IpVersion
} | { kind
: "base64"
; message?
: string
} | { kind
: "base64url"
; message?
: string
}
ZodTupleItems
Ƭ ZodTupleItems: [ZodTypeAny
, …ZodTypeAny[]]
ZodTypeAny
Ƭ ZodTypeAny: ZodType
<any
, any
, any
>
ZodUnionOptions
Ƭ ZodUnionOptions: Readonly
<[ZodTypeAny
, …ZodTypeAny[]]>
arrayOutputType
Ƭ arrayOutputType<T
, Cardinality
>: Cardinality
extends "atleastone"
? [T
["_output"
], …T[“_output”][]] : T
["_output"
][]
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Cardinality | extends ArrayCardinality = "many" |
baseObjectInputType
Ƭ baseObjectInputType<Shape
>: addQuestionMarks
<{ [k in keyof Shape]: Shape[k][“_input”] }>
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
baseObjectOutputType
Ƭ baseObjectOutputType<Shape
>: { [k in keyof Shape]: Shape[k][“_output”] }
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
deoptional
Ƭ deoptional<T
>: T
extends ZodOptional
<infer U> ? deoptional
<U
> : T
extends ZodNullable
<infer U> ? ZodNullable
<deoptional
<U
>> : T
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
inferFlattenedErrors
Ƭ inferFlattenedErrors<T
, U
>: typeToFlattenedError
<TypeOf
<T
>, U
>
Type parameters
Name | Type |
---|---|
T | extends ZodType <any , any , any > |
U | string |
inferFormattedError
Ƭ inferFormattedError<T
, U
>: ZodFormattedError
<TypeOf
<T
>, U
>
Type parameters
Name | Type |
---|---|
T | extends ZodType <any , any , any > |
U | string |
input
Ƭ input<T
>: T
["_input"
]
Type parameters
Name | Type |
---|---|
T | extends ZodType <any , any , any > |
mergeTypes
Ƭ mergeTypes<A
, B
>: { [k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never }
Type parameters
Name |
---|
A |
B |
noUnrecognized
Ƭ noUnrecognized<Obj
, Shape
>: { [k in keyof Obj]: k extends keyof Shape ? Obj[k] : never }
Type parameters
Name | Type |
---|---|
Obj | extends object |
Shape | extends object |
objectInputType
Ƭ objectInputType<Shape
, Catchall
, UnknownKeys
>: flatten
<baseObjectInputType
<Shape
>> & CatchallInput
<Catchall
> & PassthroughType
<UnknownKeys
>
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
Catchall | extends ZodTypeAny |
UnknownKeys | extends UnknownKeysParam = UnknownKeysParam |
objectOutputType
Ƭ objectOutputType<Shape
, Catchall
, UnknownKeys
>: flatten
<addQuestionMarks
<baseObjectOutputType
<Shape
>>> & CatchallOutput
<Catchall
> & PassthroughType
<UnknownKeys
>
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
Catchall | extends ZodTypeAny |
UnknownKeys | extends UnknownKeysParam = UnknownKeysParam |
output
Ƭ output<T
>: T
["_output"
]
Type parameters
Name | Type |
---|---|
T | extends ZodType <any , any , any > |
typeToFlattenedError
Ƭ typeToFlattenedError<T
, U
>: Object
Type parameters
Name | Type |
---|---|
T | T |
U | string |
Type declaration
Name | Type |
---|---|
fieldErrors | { [P in allKeys<T>]?: U[] } |
formErrors | U [] |
typecast
Ƭ typecast<A
, T
>: A
extends T
? A
: never
Type parameters
Name |
---|
A |
T |
Variables
BRAND
• Const
BRAND: unique symbol
EMPTY_PATH
• Const
EMPTY_PATH: ParsePath
INVALID
• INVALID: INVALID
NEVER
• Const
NEVER: never
ZodIssueCode
• Const
ZodIssueCode: Object
Type declaration
Name | Type |
---|---|
custom | "custom" |
invalid_arguments | "invalid_arguments" |
invalid_date | "invalid_date" |
invalid_enum_value | "invalid_enum_value" |
invalid_intersection_types | "invalid_intersection_types" |
invalid_literal | "invalid_literal" |
invalid_return_type | "invalid_return_type" |
invalid_string | "invalid_string" |
invalid_type | "invalid_type" |
invalid_union | "invalid_union" |
invalid_union_discriminator | "invalid_union_discriminator" |
not_finite | "not_finite" |
not_multiple_of | "not_multiple_of" |
too_big | "too_big" |
too_small | "too_small" |
unrecognized_keys | "unrecognized_keys" |
ZodParsedType
• Const
ZodParsedType: Object
Type declaration
Name | Type |
---|---|
array | "array" |
bigint | "bigint" |
boolean | "boolean" |
date | "date" |
float | "float" |
function | "function" |
integer | "integer" |
map | "map" |
nan | "nan" |
never | "never" |
null | "null" |
number | "number" |
object | "object" |
promise | "promise" |
set | "set" |
string | "string" |
symbol | "symbol" |
undefined | "undefined" |
unknown | "unknown" |
void | "void" |
coerce
• Const
coerce: Object
Type declaration
Name | Type |
---|---|
bigint | typeof ZodBigInt ["create" ] |
boolean | typeof ZodBoolean ["create" ] |
date | typeof ZodDate ["create" ] |
number | typeof ZodNumber ["create" ] |
string | typeof ZodString ["create" ] |
late
• Const
late: Object
Type declaration
Name | Type |
---|---|
object | <Shape>(shape : () => Shape , params? : RawCreateParams ) => ZodObject <Shape , "strip" > |
Functions
DIRTY
▸ DIRTY<T
>(value
): DIRTY
<T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
value | T |
Returns
DIRTY
<T
>
OK
▸ OK<T
>(value
): OK
<T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
value | T |
Returns
OK
<T
>
addIssueToContext
▸ addIssueToContext(ctx
, issueData
): void
Parameters
Name | Type |
---|---|
ctx | ParseContext |
issueData | IssueData |
Returns
void
any
▸ any(params?
): ZodAny
Parameters
Name | Type |
---|---|
params? | RawCreateParams |
Returns
array
▸ array<El
>(schema
, params?
): ZodArray
<El
, "many"
>
Type parameters
Name | Type |
---|---|
El | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
schema | El |
params? | RawCreateParams |
Returns
ZodArray
<El
, "many"
>
bigint
▸ bigint(params?
): ZodBigInt
Parameters
Name | Type |
---|---|
params? | { description? : string ; errorMap? : ZodErrorMap ; invalid_type_error? : string ; message? : string ; required_error? : string } & { coerce? : boolean } |
Returns
boolean
▸ boolean(params?
): ZodBoolean
Parameters
Name | Type |
---|---|
params? | { description? : string ; errorMap? : ZodErrorMap ; invalid_type_error? : string ; message? : string ; required_error? : string } & { coerce? : boolean } |
Returns
custom
▸ custom<T
>(check?
, _params?
, fatal?
): ZodType
<T
, ZodTypeDef
, T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
check? | (data : any ) => any | - |
_params? | string | CustomParams | (input : any ) => CustomParams | - |
fatal? | boolean | Deprecated Pass fatal into the params object instead: ts z.string().custom((val) => val.length > 5, { fatal: false }) |
Returns
ZodType
<T
, ZodTypeDef
, T
>
date
▸ date(params?
): ZodDate
Parameters
Name | Type |
---|---|
params? | { description? : string ; errorMap? : ZodErrorMap ; invalid_type_error? : string ; message? : string ; required_error? : string } & { coerce? : boolean } |
Returns
datetimeRegex
▸ datetimeRegex(args
): RegExp
Parameters
Name | Type |
---|---|
args | Object |
args.local? | boolean |
args.offset? | boolean |
args.precision? | null | number |
Returns
RegExp
defaultErrorMap
▸ defaultErrorMap(issue
, _ctx
): Object
Parameters
Name | Type |
---|---|
issue | ZodIssueOptionalMessage |
_ctx | ErrorMapCtx |
Returns
Object
Name | Type |
---|---|
message | string |
discriminatedUnion
▸ discriminatedUnion<Discriminator
, Types
>(discriminator
, options
, params?
): ZodDiscriminatedUnion
<Discriminator
, Types
>
The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. However, it only allows a union of objects, all of which need to share a discriminator property. This property must have a different value for each object in the union.
Type parameters
Name | Type |
---|---|
Discriminator | extends string |
Types | extends readonly [ZodDiscriminatedUnionOption <Discriminator >, ZodDiscriminatedUnionOption <Discriminator >] |
Parameters
Name | Type | Description |
---|---|---|
discriminator | Discriminator | the name of the discriminator property |
options | Types | - |
params? | RawCreateParams |
Returns
ZodDiscriminatedUnion
<Discriminator
, Types
>
effect
▸ effect<I
>(schema
, effect
, params?
): ZodEffects
<I
, I
["_output"
], input
<I
>>
Type parameters
Name | Type |
---|---|
I | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
schema | I |
effect | Effect <I ["_output" ]> |
params? | RawCreateParams |
Returns
ZodEffects
<I
, I
["_output"
], input
<I
>>
enum
▸ enum<U
, T
>(values
, params?
): ZodEnum
<Writeable
<T
>>
Type parameters
Name | Type |
---|---|
U | extends string |
T | extends readonly [U , U ] |
Parameters
Name | Type |
---|---|
values | T |
params? | RawCreateParams |
Returns
▸ enum<U
, T
>(values
, params?
): ZodEnum
<T
>
Type parameters
Name | Type |
---|---|
U | extends string |
T | extends [U , …U[]] |
Parameters
Name | Type |
---|---|
values | T |
params? | RawCreateParams |
Returns
ZodEnum
<T
>
function
▸ function(): ZodFunction
<ZodTuple
<[], ZodUnknown
>, ZodUnknown
>
Returns
ZodFunction
<ZodTuple
<[], ZodUnknown
>, ZodUnknown
>
▸ function<T
>(args
): ZodFunction
<T
, ZodUnknown
>
Type parameters
Name | Type |
---|---|
T | extends AnyZodTuple = ZodTuple <[], ZodUnknown > |
Parameters
Name | Type |
---|---|
args | T |
Returns
▸ function<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
>
▸ function<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
>
getErrorMap
▸ getErrorMap(): ZodErrorMap
Returns
getParsedType
▸ getParsedType(data
): "string"
| "number"
| "bigint"
| "boolean"
| "symbol"
| "undefined"
| "object"
| "function"
| "nan"
| "integer"
| "float"
| "date"
| "null"
| "array"
| "unknown"
| "promise"
| "void"
| "never"
| "map"
| "set"
Parameters
Name | Type |
---|---|
data | any |
Returns
"string"
| "number"
| "bigint"
| "boolean"
| "symbol"
| "undefined"
| "object"
| "function"
| "nan"
| "integer"
| "float"
| "date"
| "null"
| "array"
| "unknown"
| "promise"
| "void"
| "never"
| "map"
| "set"
instanceof
▸ instanceof<T
>(cls
, params?
): ZodType
<InstanceType
<T
>, ZodTypeDef
, InstanceType
<T
>>
Type parameters
Name | Type |
---|---|
T | extends typeof Class |
Parameters
Name | Type |
---|---|
cls | T |
params? | CustomParams |
Returns
ZodType
<InstanceType
<T
>, ZodTypeDef
, InstanceType
<T
>>
intersection
▸ intersection<TSchema
, USchema
>(left
, right
, params?
): ZodIntersection
<TSchema
, USchema
>
Type parameters
Name | Type |
---|---|
TSchema | extends ZodTypeAny |
USchema | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
left | TSchema |
right | USchema |
params? | RawCreateParams |
Returns
ZodIntersection
<TSchema
, USchema
>
isAborted
▸ isAborted(x
): x is INVALID
Parameters
Name | Type |
---|---|
x | ParseReturnType <any > |
Returns
x is INVALID
isAsync
▸ isAsync<T
>(x
): x is AsyncParseReturnType<T>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
x | ParseReturnType <T > |
Returns
x is AsyncParseReturnType<T>
isDirty
▸ isDirty<T
>(x
): x is OK<T> | DIRTY<T>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
x | ParseReturnType <T > |
Returns
x is OK<T> | DIRTY<T>
isValid
▸ isValid<T
>(x
): x is OK<T>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
x | ParseReturnType <T > |
Returns
x is OK<T>
lazy
▸ lazy<Inner
>(getter
, params?
): ZodLazy
<Inner
>
Type parameters
Name | Type |
---|---|
Inner | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
getter | () => Inner |
params? | RawCreateParams |
Returns
ZodLazy
<Inner
>
literal
▸ literal<Value
>(value
, params?
): ZodLiteral
<Value
>
Type parameters
Name | Type |
---|---|
Value | extends Primitive |
Parameters
Name | Type |
---|---|
value | Value |
params? | RawCreateParams |
Returns
ZodLiteral
<Value
>
makeIssue
▸ makeIssue(params
): ZodIssue
Parameters
Name | Type |
---|---|
params | Object |
params.data | any |
params.errorMaps | ZodErrorMap [] |
params.issueData | IssueData |
params.path | (string | number )[] |
Returns
map
▸ map<KeySchema
, ValueSchema
>(keyType
, valueType
, params?
): ZodMap
<KeySchema
, ValueSchema
>
Type parameters
Name | Type |
---|---|
KeySchema | extends ZodTypeAny = ZodTypeAny |
ValueSchema | extends ZodTypeAny = ZodTypeAny |
Parameters
Name | Type |
---|---|
keyType | KeySchema |
valueType | ValueSchema |
params? | RawCreateParams |
Returns
ZodMap
<KeySchema
, ValueSchema
>
nan
▸ nan(params?
): ZodNaN
Parameters
Name | Type |
---|---|
params? | RawCreateParams |
Returns
nativeEnum
▸ nativeEnum<Elements
>(values
, params?
): ZodNativeEnum
<Elements
>
Type parameters
Name | Type |
---|---|
Elements | extends EnumLike |
Parameters
Name | Type |
---|---|
values | Elements |
params? | RawCreateParams |
Returns
ZodNativeEnum
<Elements
>
never
▸ never(params?
): ZodNever
Parameters
Name | Type |
---|---|
params? | RawCreateParams |
Returns
null
▸ null(params?
): ZodNull
Parameters
Name | Type |
---|---|
params? | RawCreateParams |
Returns
nullable
▸ nullable<Inner
>(type
, params?
): ZodNullable
<Inner
>
Type parameters
Name | Type |
---|---|
Inner | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
type | Inner |
params? | RawCreateParams |
Returns
ZodNullable
<Inner
>
number
▸ number(params?
): ZodNumber
Parameters
Name | Type |
---|---|
params? | { description? : string ; errorMap? : ZodErrorMap ; invalid_type_error? : string ; message? : string ; required_error? : string } & { coerce? : boolean } |
Returns
object
▸ object<Shape
>(shape
, params?
): ZodObject
<Shape
, "strip"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
Parameters
Name | Type |
---|---|
shape | Shape |
params? | RawCreateParams |
Returns
ZodObject
<Shape
, "strip"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
oboolean
▸ oboolean(): ZodOptional
<ZodBoolean
>
Returns
onumber
▸ onumber(): ZodOptional
<ZodNumber
>
Returns
optional
▸ optional<Inner
>(type
, params?
): ZodOptional
<Inner
>
Type parameters
Name | Type |
---|---|
Inner | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
type | Inner |
params? | RawCreateParams |
Returns
ZodOptional
<Inner
>
ostring
▸ ostring(): ZodOptional
<ZodString
>
Returns
pipeline
▸ pipeline<ASchema
, BSchema
>(a
, b
): ZodPipeline
<ASchema
, BSchema
>
Type parameters
Name | Type |
---|---|
ASchema | extends ZodTypeAny |
BSchema | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
a | ASchema |
b | BSchema |
Returns
ZodPipeline
<ASchema
, BSchema
>
preprocess
▸ preprocess<I
>(preprocess
, schema
, params?
): ZodEffects
<I
, I
["_output"
], unknown
>
Type parameters
Name | Type |
---|---|
I | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
preprocess | (arg : unknown , ctx : RefinementCtx ) => unknown |
schema | I |
params? | RawCreateParams |
Returns
ZodEffects
<I
, I
["_output"
], unknown
>
promise
▸ promise<Inner
>(schema
, params?
): ZodPromise
<Inner
>
Type parameters
Name | Type |
---|---|
Inner | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
schema | Inner |
params? | RawCreateParams |
Returns
ZodPromise
<Inner
>
quotelessJson
▸ quotelessJson(obj
): string
Parameters
Name | Type |
---|---|
obj | any |
Returns
string
record
▸ record<Value
>(valueType
, params?
): ZodRecord
<ZodString
, Value
>
Type parameters
Name | Type |
---|---|
Value | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
valueType | Value |
params? | RawCreateParams |
Returns
▸ record<Keys
, Value
>(keySchema
, valueType
, params?
): ZodRecord
<Keys
, Value
>
Type parameters
Name | Type |
---|---|
Keys | extends KeySchema |
Value | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
keySchema | Keys |
valueType | Value |
params? | RawCreateParams |
Returns
ZodRecord
<Keys
, Value
>
set
▸ set<ValueSchema
>(valueType
, params?
): ZodSet
<ValueSchema
>
Type parameters
Name | Type |
---|---|
ValueSchema | extends ZodTypeAny = ZodTypeAny |
Parameters
Name | Type |
---|---|
valueType | ValueSchema |
params? | RawCreateParams |
Returns
ZodSet
<ValueSchema
>
setErrorMap
▸ setErrorMap(map
): void
Parameters
Name | Type |
---|---|
map | ZodErrorMap |
Returns
void
strictObject
▸ strictObject<Shape
>(shape
, params?
): ZodObject
<Shape
, "strict"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
Parameters
Name | Type |
---|---|
shape | Shape |
params? | RawCreateParams |
Returns
ZodObject
<Shape
, "strict"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
string
▸ string(params?
): ZodString
Parameters
Name | Type |
---|---|
params? | { description? : string ; errorMap? : ZodErrorMap ; invalid_type_error? : string ; message? : string ; required_error? : string } & { coerce? : true } |
Returns
symbol
▸ symbol(params?
): ZodSymbol
Parameters
Name | Type |
---|---|
params? | RawCreateParams |
Returns
tuple
▸ tuple<Items
>(schemas
, params?
): ZodTuple
<Items
, null
>
Type parameters
Name | Type |
---|---|
Items | extends [] | [ZodTypeAny , …ZodTypeAny[]] |
Parameters
Name | Type |
---|---|
schemas | Items |
params? | RawCreateParams |
Returns
ZodTuple
<Items
, null
>
undefined
▸ undefined(params?
): ZodUndefined
Parameters
Name | Type |
---|---|
params? | RawCreateParams |
Returns
union
▸ union<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
>
unknown
▸ unknown(params?
): ZodUnknown
Parameters
Name | Type |
---|---|
params? | RawCreateParams |
Returns
void
▸ void(params?
): ZodVoid
Parameters
Name | Type |
---|---|
params? | RawCreateParams |