zod
- Version 3.24.3
- Published
- 698 kB
- No dependencies
- MIT license
Install
npm i zod
yarn add zod
pnpm add zod
Overview
TypeScript-first schema declaration and validation library with static type inference
Index
Variables
Functions
- addIssueToContext()
- any()
- array()
- bigint()
- boolean()
- custom()
- date()
- datetimeRegex()
- DIRTY()
- effect()
- getErrorMap()
- getParsedType()
- instanceof()
- intersection()
- isAborted()
- isAsync()
- isDirty()
- isValid()
- lazy()
- literal()
- makeIssue()
- map()
- nan()
- nativeEnum()
- never()
- null()
- nullable()
- number()
- object()
- oboolean()
- OK()
- onumber()
- optional()
- ostring()
- preprocess()
- promise()
- quotelessJson()
- set()
- setErrorMap()
- strictObject()
- string()
- symbol()
- transformer()
- tuple()
- undefined()
- union()
- unknown()
- void()
Classes
ZodString
- base64()
- base64url()
- cidr()
- create
- cuid()
- cuid2()
- date()
- datetime()
- duration()
- email()
- emoji()
- endsWith()
- includes()
- ip()
- isBase64
- isBase64url
- isCIDR
- isCUID
- isCUID2
- isDate
- isDatetime
- isDuration
- isEmail
- isEmoji
- isIP
- isNANOID
- isTime
- isULID
- isURL
- isUUID
- jwt()
- length()
- max()
- maxLength
- min()
- minLength
- nanoid()
- nonempty()
- regex()
- startsWith()
- time()
- toLowerCase()
- toUpperCase()
- trim()
- ulid()
- url()
- uuid()
Interfaces
Enums
ZodFirstPartyTypeKind
- ZodAny
- ZodArray
- ZodBigInt
- ZodBoolean
- ZodBranded
- ZodCatch
- ZodDate
- ZodDefault
- ZodDiscriminatedUnion
- ZodEffects
- ZodEnum
- ZodFunction
- ZodIntersection
- ZodLazy
- ZodLiteral
- ZodMap
- ZodNaN
- ZodNativeEnum
- ZodNever
- ZodNull
- ZodNullable
- ZodNumber
- ZodObject
- ZodOptional
- ZodPipeline
- ZodPromise
- ZodReadonly
- ZodRecord
- ZodSet
- ZodString
- ZodSymbol
- ZodTuple
- ZodUndefined
- ZodUnion
- ZodUnknown
- ZodVoid
Type Aliases
- AnyZodObject
- AnyZodTuple
- ArrayCardinality
- ArrayKeys
- arrayOutputType
- AssertArray
- AsyncParseReturnType
- baseObjectInputType
- baseObjectOutputType
- BRAND
- CatchallInput
- CatchallOutput
- CustomErrorParams
- DenormalizedError
- deoptional
- DIRTY
- Effect
- EnumLike
- EnumValues
- ErrorMapCtx
- FilterEnum
- Indices
- infer
- inferFlattenedErrors
- inferFormattedError
- InnerTypeOfFunction
- input
- InputTypeOfTuple
- InputTypeOfTupleWithRest
- INVALID
- IpVersion
- IssueData
- KeySchema
- mergeTypes
- noUnrecognized
- objectInputType
- objectOutputType
- ObjectPair
- OK
- OuterTypeOfFunction
- output
- OutputTypeOfTuple
- OutputTypeOfTupleWithRest
- ParseInput
- ParseParams
- ParsePath
- ParsePathComponent
- ParseReturnType
- PassthroughType
- PreprocessEffect
- Primitive
- ProcessedCreateParams
- RawCreateParams
- RecordType
- Refinement
- RefinementEffect
- SafeParseError
- SafeParseReturnType
- SafeParseSuccess
- Scalars
- SomeZodObject
- StringValidation
- SuperRefinement
- SyncParseReturnType
- TransformEffect
- typecast
- TypeOf
- typeToFlattenedError
- UnknownKeysParam
- Values
- Writeable
- ZodBigIntCheck
- ZodDateCheck
- ZodDiscriminatedUnionOption
- ZodErrorMap
- ZodFirstPartySchemaTypes
- ZodFormattedError
- ZodIssue
- ZodIssueBase
- ZodIssueCode
- ZodIssueOptionalMessage
- ZodNonEmptyArray
- ZodNullableType
- ZodNumberCheck
- ZodOptionalType
- ZodParsedType
- ZodRawShape
- ZodStringCheck
- ZodTupleItems
- ZodTypeAny
- ZodUnionOptions
Namespaces
z
- addIssueToContext()
- any()
- AnyZodObject
- AnyZodTuple
- array()
- ArrayCardinality
- ArrayKeys
- arrayOutputType
- AssertArray
- AsyncParseReturnType
- baseObjectInputType
- baseObjectOutputType
- bigint()
- boolean()
- BRAND
- BRAND
- CatchallInput
- CatchallOutput
- coerce
- custom()
- CustomErrorParams
- date()
- datetimeRegex()
- defaultErrorMap
- DenormalizedError
- deoptional
- DIRTY()
- DIRTY
- discriminatedUnion
- effect()
- Effect
- EMPTY_PATH
- enum
- EnumLike
- EnumValues
- ErrorMapCtx
- FilterEnum
- function
- getErrorMap()
- getParsedType()
- Indices
- infer
- inferFlattenedErrors
- inferFormattedError
- InnerTypeOfFunction
- input
- InputTypeOfTuple
- InputTypeOfTupleWithRest
- instanceof()
- intersection()
- INVALID
- INVALID
- IpVersion
- isAborted()
- isAsync()
- isDirty()
- IssueData
- isValid()
- KeySchema
- late
- lazy()
- literal()
- makeIssue()
- map()
- mergeTypes
- nan()
- nativeEnum()
- never()
- NEVER
- noUnrecognized
- null()
- nullable()
- number()
- object()
- objectInputType
- objectOutputType
- ObjectPair
- oboolean()
- OK()
- OK
- onumber()
- optional()
- ostring()
- OuterTypeOfFunction
- output
- OutputTypeOfTuple
- OutputTypeOfTupleWithRest
- ParseContext
- ParseInput
- ParseParams
- ParsePath
- ParsePathComponent
- ParseResult
- ParseReturnType
- ParseStatus
- PassthroughType
- pipeline
- preprocess()
- PreprocessEffect
- Primitive
- ProcessedCreateParams
- promise()
- quotelessJson()
- RawCreateParams
- record
- RecordType
- Refinement
- RefinementCtx
- RefinementEffect
- SafeParseError
- SafeParseReturnType
- SafeParseSuccess
- Scalars
- Schema
- set()
- setErrorMap()
- SomeZodObject
- strictObject()
- string()
- StringValidation
- SuperRefinement
- symbol()
- SyncParseReturnType
- TransformEffect
- transformer()
- tuple()
- typecast
- TypeOf
- typeToFlattenedError
- undefined()
- union()
- unknown()
- UnknownKeysParam
- Values
- void()
- Writeable
- ZodAny
- ZodAnyDef
- ZodArray
- ZodArrayDef
- ZodBigInt
- ZodBigIntCheck
- ZodBigIntDef
- ZodBoolean
- ZodBooleanDef
- ZodBranded
- ZodBrandedDef
- ZodCatch
- ZodCatchDef
- ZodCustomIssue
- ZodDate
- ZodDateCheck
- ZodDateDef
- ZodDefault
- ZodDefaultDef
- ZodDiscriminatedUnion
- ZodDiscriminatedUnionDef
- ZodDiscriminatedUnionOption
- ZodEffects
- ZodEffectsDef
- ZodEnum
- ZodEnumDef
- ZodError
- ZodErrorMap
- ZodFirstPartySchemaTypes
- ZodFirstPartyTypeKind
- ZodFormattedError
- ZodFunction
- ZodFunctionDef
- ZodIntersection
- ZodIntersectionDef
- ZodInvalidArgumentsIssue
- ZodInvalidDateIssue
- ZodInvalidEnumValueIssue
- ZodInvalidIntersectionTypesIssue
- ZodInvalidLiteralIssue
- ZodInvalidReturnTypeIssue
- ZodInvalidStringIssue
- ZodInvalidTypeIssue
- ZodInvalidUnionDiscriminatorIssue
- ZodInvalidUnionIssue
- ZodIssue
- ZodIssueBase
- ZodIssueCode
- ZodIssueCode
- ZodIssueOptionalMessage
- ZodLazy
- ZodLazyDef
- ZodLiteral
- ZodLiteralDef
- ZodMap
- ZodMapDef
- ZodNaN
- ZodNaNDef
- ZodNativeEnum
- ZodNativeEnumDef
- ZodNever
- ZodNeverDef
- ZodNonEmptyArray
- ZodNotFiniteIssue
- ZodNotMultipleOfIssue
- ZodNull
- ZodNullable
- ZodNullableDef
- ZodNullableType
- ZodNullDef
- ZodNumber
- ZodNumberCheck
- ZodNumberDef
- ZodObject
- ZodObjectDef
- ZodOptional
- ZodOptionalDef
- ZodOptionalType
- ZodParsedType
- ZodParsedType
- ZodPipeline
- ZodPipelineDef
- ZodPromise
- ZodPromiseDef
- ZodRawShape
- ZodReadonly
- ZodReadonlyDef
- ZodRecord
- ZodRecordDef
- ZodSchema
- ZodSet
- ZodSetDef
- ZodString
- ZodStringCheck
- ZodStringDef
- ZodSymbol
- ZodSymbolDef
- ZodTooBigIssue
- ZodTooSmallIssue
- ZodTransformer
- ZodTuple
- ZodTupleDef
- ZodTupleItems
- ZodType
- ZodTypeAny
- ZodTypeDef
- ZodUndefined
- ZodUndefinedDef
- ZodUnion
- ZodUnionDef
- ZodUnionOptions
- ZodUnknown
- ZodUnknownDef
- ZodUnrecognizedKeysIssue
- ZodVoid
- ZodVoidDef
Variables
variable BRAND
const BRAND: Symbol;
variable coerce
const coerce: { string: (params?: RawCreateParams & { coerce?: true }) => ZodString; number: (params?: RawCreateParams & { coerce?: boolean }) => ZodNumber; boolean: (params?: RawCreateParams & { coerce?: boolean }) => ZodBoolean; bigint: (params?: RawCreateParams & { coerce?: boolean }) => ZodBigInt; date: (params?: RawCreateParams & { coerce?: boolean }) => ZodDate;};
variable defaultErrorMap
const defaultErrorMap: ZodErrorMap;
variable discriminatedUnion
const discriminatedUnion: < Discriminator extends string, Types extends readonly [ ZodDiscriminatedUnionOption<Discriminator>, ...ZodDiscriminatedUnionOption<Discriminator>[] ]>( discriminator: Discriminator, options: Types, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; }) => ZodDiscriminatedUnion<Discriminator, Types>;
variable EMPTY_PATH
const EMPTY_PATH: ParsePath;
variable enum
const enum: { <U extends string, T extends readonly [U, ...U[]]>(values: T, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; }): ZodEnum<Writeable<T>>; <U extends string, T extends [U, ...U[]]>(values: T, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; }): ZodEnum<T>; }
variable function
const function: { (): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>; <T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>; <T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>; <T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; }): ZodFunction<T, U>; }
variable INVALID
const INVALID: INVALID;
variable late
const late: { object: <T extends ZodRawShape>( shape: () => T, params?: RawCreateParams ) => ZodObject< T, 'strip', ZodTypeAny, { [k in keyof objectUtil.addQuestionMarks< baseObjectOutputType<T>, any >]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, any>[k]; }, { [k in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k] } >;};
variable NEVER
const NEVER: never;
variable pipeline
const pipeline: <A extends ZodTypeAny, B extends ZodTypeAny>( a: A, b: B) => ZodPipeline<A, B>;
variable record
const record: { <Value extends ZodTypeAny>( valueType: Value, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodRecord<ZodString, Value>; <Keys extends KeySchema, Value extends ZodTypeAny>( keySchema: Keys, valueType: Value, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodRecord<Keys, Value>;};
variable ZodIssueCode
const ZodIssueCode: { invalid_type: 'invalid_type'; invalid_literal: 'invalid_literal'; custom: 'custom'; invalid_union: 'invalid_union'; invalid_union_discriminator: 'invalid_union_discriminator'; invalid_enum_value: 'invalid_enum_value'; unrecognized_keys: 'unrecognized_keys'; invalid_arguments: 'invalid_arguments'; invalid_return_type: 'invalid_return_type'; invalid_date: 'invalid_date'; invalid_string: 'invalid_string'; too_small: 'too_small'; too_big: 'too_big'; invalid_intersection_types: 'invalid_intersection_types'; not_multiple_of: 'not_multiple_of'; not_finite: 'not_finite';};
variable ZodParsedType
const ZodParsedType: { string: 'string'; number: 'number'; bigint: 'bigint'; boolean: 'boolean'; symbol: 'symbol'; undefined: 'undefined'; object: 'object'; function: 'function'; map: 'map'; nan: 'nan'; integer: 'integer'; float: 'float'; date: 'date'; null: 'null'; array: 'array'; unknown: 'unknown'; promise: 'promise'; void: 'void'; never: 'never'; set: 'set';};
Functions
function addIssueToContext
addIssueToContext: (ctx: ParseContext, issueData: IssueData) => void;
function any
any: (params?: RawCreateParams) => ZodAny;
function array
array: <T extends ZodTypeAny>( schema: T, params?: RawCreateParams) => ZodArray<T, 'many'>;
function bigint
bigint: (params?: RawCreateParams & { coerce?: boolean }) => ZodBigInt;
function boolean
boolean: (params?: RawCreateParams & { coerce?: boolean }) => ZodBoolean;
function custom
custom: <T>( check?: (data: any) => any, _params?: string | CustomParams | ((input: any) => CustomParams), fatal?: boolean) => ZodType<T, ZodTypeDef, T>;
function date
date: (params?: RawCreateParams & { coerce?: boolean }) => ZodDate;
function datetimeRegex
datetimeRegex: (args: { precision?: number | null; offset?: boolean; local?: boolean;}) => RegExp;
function DIRTY
DIRTY: <T>(value: T) => DIRTY<T>;
function effect
effect: <I extends ZodTypeAny>( schema: I, effect: Effect<I['_output']>, params?: RawCreateParams) => ZodEffects<I, I['_output'], input<I>>;
function getErrorMap
getErrorMap: () => ZodErrorMap;
function getParsedType
getParsedType: (data: any) => ZodParsedType;
function instanceof
instanceof: <T extends typeof Class>(cls: T, params?: CustomParams) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>
function intersection
intersection: <T extends ZodTypeAny, U extends ZodTypeAny>( left: T, right: U, params?: RawCreateParams) => ZodIntersection<T, U>;
function isAborted
isAborted: (x: ParseReturnType<any>) => x is INVALID;
function isAsync
isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
function isDirty
isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
function isValid
isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
function lazy
lazy: <T extends ZodTypeAny>( getter: () => T, params?: RawCreateParams) => ZodLazy<T>;
function literal
literal: <T extends Primitive>( value: T, params?: RawCreateParams) => ZodLiteral<T>;
function makeIssue
makeIssue: (params: { data: any; path: (string | number)[]; errorMaps: ZodErrorMap[]; issueData: IssueData;}) => ZodIssue;
function map
map: < Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>( keyType: Key, valueType: Value, params?: RawCreateParams) => ZodMap<Key, Value>;
function nan
nan: (params?: RawCreateParams) => ZodNaN;
function nativeEnum
nativeEnum: <T extends EnumLike>( values: T, params?: RawCreateParams) => ZodNativeEnum<T>;
function never
never: (params?: RawCreateParams) => ZodNever;
function null
null: (params?: RawCreateParams) => ZodNull
function nullable
nullable: <T extends ZodTypeAny>( type: T, params?: RawCreateParams) => ZodNullable<T>;
function number
number: (params?: RawCreateParams & { coerce?: boolean }) => ZodNumber;
function object
object: <T extends ZodRawShape>( shape: T, params?: RawCreateParams) => ZodObject< T, 'strip', ZodTypeAny, { [k in keyof objectUtil.addQuestionMarks< baseObjectOutputType<T>, any >]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, any>[k]; }, { [k in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k] }>;
function oboolean
oboolean: () => ZodOptional<ZodBoolean>;
function OK
OK: <T>(value: T) => OK<T>;
function onumber
onumber: () => ZodOptional<ZodNumber>;
function optional
optional: <T extends ZodTypeAny>( type: T, params?: RawCreateParams) => ZodOptional<T>;
function ostring
ostring: () => ZodOptional<ZodString>;
function preprocess
preprocess: <I extends ZodTypeAny>( preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I['_output'], unknown>;
function promise
promise: <T extends ZodTypeAny>( schema: T, params?: RawCreateParams) => ZodPromise<T>;
function quotelessJson
quotelessJson: (obj: any) => string;
function set
set: <Value extends ZodTypeAny = ZodTypeAny>( valueType: Value, params?: RawCreateParams) => ZodSet<Value>;
function setErrorMap
setErrorMap: (map: ZodErrorMap) => void;
function strictObject
strictObject: <T extends ZodRawShape>( shape: T, params?: RawCreateParams) => ZodObject< T, 'strict', ZodTypeAny, { [k in keyof objectUtil.addQuestionMarks< baseObjectOutputType<T>, any >]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, any>[k]; }, { [k in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k] }>;
function string
string: (params?: RawCreateParams & { coerce?: true }) => ZodString;
function symbol
symbol: (params?: RawCreateParams) => ZodSymbol;
function transformer
transformer: <I extends ZodTypeAny>( schema: I, effect: Effect<I['_output']>, params?: RawCreateParams) => ZodEffects<I, I['_output'], input<I>>;
function tuple
tuple: <T extends [] | [ZodTypeAny, ...ZodTypeAny[]]>( schemas: T, params?: RawCreateParams) => ZodTuple<T, null>;
function undefined
undefined: (params?: RawCreateParams) => ZodUndefined;
function union
union: <T extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>( types: T, params?: RawCreateParams) => ZodUnion<T>;
function unknown
unknown: (params?: RawCreateParams) => ZodUnknown;
function void
void: (params?: RawCreateParams) => ZodVoid
Classes
class ParseStatus
class ParseStatus {}
property value
value: 'aborted' | 'dirty' | 'valid';
method abort
abort: () => void;
method dirty
dirty: () => void;
method mergeArray
static mergeArray: ( status: ParseStatus, results: SyncParseReturnType<any>[]) => SyncParseReturnType;
method mergeObjectAsync
static mergeObjectAsync: ( status: ParseStatus, pairs: { key: ParseReturnType<any>; value: ParseReturnType<any> }[]) => Promise<SyncParseReturnType<any>>;
method mergeObjectSync
static mergeObjectSync: ( status: ParseStatus, pairs: { key: SyncParseReturnType<any>; value: SyncParseReturnType<any>; alwaysSet?: boolean; }[]) => SyncParseReturnType;
class Schema
abstract class ZodType< Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {}
constructor
constructor(def: ZodTypeDef);
property "~standard"
'~standard': StandardSchemaV1.Props<Input, Output>;
property description
readonly description: string;
property spa
spa: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
Alias of safeParseAsync
method "~validate"
'~validate': ( data: unknown) => StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
method and
and: <T extends ZodTypeAny>(incoming: T) => ZodIntersection<this, T>;
method array
array: () => ZodArray<this>;
method brand
brand: <B extends string | number | symbol>(brand?: B) => ZodBranded<this, B>;
method catch
catch: { (def: Output): ZodCatch<this>; ( def: (ctx: { error: ZodError<any>; input: Input }) => Output ): ZodCatch<this>;};
method default
default: { (def: util.noUndefined<Input>): ZodDefault<this>; (def: () => util.noUndefined<Input>): ZodDefault<this>;};
method describe
describe: (description: string) => this;
method isNullable
isNullable: () => boolean;
method isOptional
isOptional: () => boolean;
method nullable
nullable: () => ZodNullable<this>;
method nullish
nullish: () => ZodOptional<ZodNullable<this>>;
method optional
optional: () => ZodOptional<this>;
method or
or: <T extends ZodTypeAny>(option: T) => ZodUnion<[this, T]>;
method parse
parse: (data: unknown, params?: Partial<ParseParams>) => Output;
method parseAsync
parseAsync: (data: unknown, params?: Partial<ParseParams>) => Promise<Output>;
method pipe
pipe: <T extends ZodTypeAny>(target: T) => ZodPipeline<this, T>;
method promise
promise: () => ZodPromise<this>;
method readonly
readonly: () => ZodReadonly<this>;
method refine
refine: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => CustomErrorParams) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => unknown, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => Partial<util.Omit<ZodCustomIssue, 'code'>>) ): ZodEffects<this, Output, Input>;};
method refinement
refinement: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => boolean, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, Output, Input>;};
method safeParse
safeParse: ( data: unknown, params?: Partial<ParseParams>) => SafeParseReturnType<Input, Output>;
method safeParseAsync
safeParseAsync: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
method superRefine
superRefine: { <RefinedOutput extends Output>( refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput ): ZodEffects<this, RefinedOutput, Input>; (refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects< this, Output, Input >; (refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects< this, Output, Input >;};
method transform
transform: <NewOut>( transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>) => ZodEffects<this, NewOut>;
class ZodAny
class ZodAny extends ZodType<any, ZodAnyDef, any> {}
property create
static create: (params?: RawCreateParams) => ZodAny;
class ZodArray
class ZodArray< T extends ZodTypeAny, Cardinality extends ArrayCardinality = 'many'> extends ZodType< arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends 'atleastone' ? [T['_input'], ...T['_input'][]] : T['_input'][]> {}
property create
static create: <T_1 extends ZodTypeAny>( schema: T_1, params?: RawCreateParams) => ZodArray<T_1, 'many'>;
property element
readonly element: ZodType<any, any, any>;
method length
length: (len: number, message?: errorUtil.ErrMessage) => this;
method max
max: (maxLength: number, message?: errorUtil.ErrMessage) => this;
method min
min: (minLength: number, message?: errorUtil.ErrMessage) => this;
method nonempty
nonempty: (message?: errorUtil.ErrMessage) => ZodArray<T, 'atleastone'>;
class ZodBigInt
class ZodBigInt extends ZodType<bigint, ZodBigIntDef, bigint> {}
property create
static create: (params?: RawCreateParams & { coerce?: boolean }) => ZodBigInt;
property max
max: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
property maxValue
readonly maxValue: BigInt;
property min
min: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
property minValue
readonly minValue: BigInt;
method gt
gt: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method gte
gte: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method lt
lt: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method lte
lte: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method multipleOf
multipleOf: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method negative
negative: (message?: errorUtil.ErrMessage) => ZodBigInt;
method nonnegative
nonnegative: (message?: errorUtil.ErrMessage) => ZodBigInt;
method nonpositive
nonpositive: (message?: errorUtil.ErrMessage) => ZodBigInt;
method positive
positive: (message?: errorUtil.ErrMessage) => ZodBigInt;
method setLimit
protected setLimit: ( kind: 'min' | 'max', value: bigint, inclusive: boolean, message?: string) => ZodBigInt;
class ZodBoolean
class ZodBoolean extends ZodType<boolean, ZodBooleanDef, boolean> {}
property create
static create: (params?: RawCreateParams & { coerce?: boolean }) => ZodBoolean;
class ZodBranded
class ZodBranded< T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T['_output'] & BRAND<B>, ZodBrandedDef<T>, T['_input']> {}
method unwrap
unwrap: () => T;
class ZodCatch
class ZodCatch<T extends ZodTypeAny> extends ZodType< T['_output'], ZodCatchDef<T>, unknown> {}
property create
static create: <T_1 extends ZodTypeAny>( type: T_1, params: { errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; message?: string | undefined; description?: string | undefined; } & { catch: T_1['_output'] | (() => T_1['_output']) }) => ZodCatch<T_1>;
method removeCatch
removeCatch: () => T;
class ZodDate
class ZodDate extends ZodType<Date, ZodDateDef, Date> {}
property create
static create: (params?: RawCreateParams & { coerce?: boolean }) => ZodDate;
property maxDate
readonly maxDate: Date;
property minDate
readonly minDate: Date;
method max
max: (maxDate: Date, message?: errorUtil.ErrMessage) => ZodDate;
method min
min: (minDate: Date, message?: errorUtil.ErrMessage) => ZodDate;
class ZodDefault
class ZodDefault<T extends ZodTypeAny> extends ZodType< util.noUndefined<T['_output']>, ZodDefaultDef<T>, T['_input'] | undefined> {}
property create
static create: <T_1 extends ZodTypeAny>( type: T_1, params: { errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; message?: string | undefined; description?: string | undefined; } & { default: T_1['_input'] | (() => util.noUndefined<T_1['_input']>) }) => ZodDefault<T_1>;
method removeDefault
removeDefault: () => T;
class ZodDiscriminatedUnion
class ZodDiscriminatedUnion< Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<Discriminator>[]> extends ZodType< output<Options[number]>, ZodDiscriminatedUnionDef<Discriminator, Options>, input<Options[number]>> {}
property discriminator
readonly discriminator: string;
property options
readonly options: readonly ZodDiscriminatedUnionOption<Discriminator>[];
property optionsMap
readonly optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
method create
static create: < Discriminator extends string, Types extends readonly [ ZodDiscriminatedUnionOption<Discriminator>, ...ZodDiscriminatedUnionOption<Discriminator>[] ]>( discriminator: Discriminator, options: Types, params?: RawCreateParams) => 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.
Parameter discriminator
the name of the discriminator property
Parameter types
an array of object schemas
Parameter params
class ZodEffects
class ZodEffects< T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {}
property create
static create: <I extends ZodTypeAny>( schema: I, effect: Effect<I['_output']>, params?: RawCreateParams) => ZodEffects<I, I['_output'], input<I>>;
property createWithPreprocess
static createWithPreprocess: <I extends ZodTypeAny>( preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I['_output'], unknown>;
method innerType
innerType: () => T;
method sourceType
sourceType: () => T;
class ZodEnum
class ZodEnum<T extends [string, ...string[]]> extends ZodType< T[number], ZodEnumDef<T>, T[number]> {}
property create
static create: { <U extends string, T extends readonly [U, ...U[]]>( values: T, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodEnum<Writeable<T>>; <U extends string, T extends [U, ...U[]]>( values: T, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodEnum<T>;};
property enum
readonly enum: Values<T>;
property Enum
readonly Enum: Values<T>;
property options
readonly options: [string, ...string[]];
property Values
readonly Values: Values<T>;
method exclude
exclude: <ToExclude extends readonly [T[number], ...T[number][]]>( values: ToExclude, newDef?: RawCreateParams) => ZodEnum< typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
method extract
extract: <ToExtract extends readonly [T[number], ...T[number][]]>( values: ToExtract, newDef?: RawCreateParams) => ZodEnum<Writeable<ToExtract>>;
class ZodError
class ZodError<T = any> extends Error {}
constructor
constructor(issues: ZodIssue[]);
property addIssue
addIssue: (sub: ZodIssue) => void;
property addIssues
addIssues: (subs?: ZodIssue[]) => void;
property create
static create: (issues: ZodIssue[]) => ZodError<any>;
property errors
readonly errors: ZodIssue[];
property formErrors
readonly formErrors: typeToFlattenedError<T, string>;
property isEmpty
readonly isEmpty: boolean;
property issues
issues: ZodIssue[];
property message
readonly message: string;
method assert
static assert: (value: unknown) => asserts value is ZodError<any>;
method flatten
flatten: { (): typeToFlattenedError<T>; <U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;};
method format
format: { (): ZodFormattedError<T>; <U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;};
method toString
toString: () => string;
class ZodFunction
class ZodFunction< Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType< OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {}
property validate
validate: <F extends InnerTypeOfFunction<Args, Returns>>( func: F) => ReturnType<F> extends Returns['_output'] ? (...args: Args['_input']) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
method args
args: <Items extends [] | [ZodTypeAny, ...ZodTypeAny[]]>( ...items: Items) => ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
method create
static create: { (): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>; <T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction< T, ZodUnknown >; <T extends AnyZodTuple, U extends ZodTypeAny>( args: T, returns: U ): ZodFunction<T, U>; < T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown >( args: T, returns: U, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodFunction<T, U>;};
method implement
implement: <F extends InnerTypeOfFunction<Args, Returns>>( func: F) => ReturnType<F> extends Returns['_output'] ? (...args: Args['_input']) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
method parameters
parameters: () => Args;
method returns
returns: <NewReturnType extends ZodType<any, any, any>>( returnType: NewReturnType) => ZodFunction<Args, NewReturnType>;
method returnType
returnType: () => Returns;
method strictImplement
strictImplement: ( func: InnerTypeOfFunction<Args, Returns>) => InnerTypeOfFunction<Args, Returns>;
class ZodIntersection
class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType< T['_output'] & U['_output'], ZodIntersectionDef<T, U>, T['_input'] & U['_input']> {}
property create
static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>( left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
class ZodLazy
class ZodLazy<T extends ZodTypeAny> extends ZodType< output<T>, ZodLazyDef<T>, input<T>> {}
class ZodLiteral
class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {}
class ZodMap
class ZodMap< Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodType< Map<Key['_output'], Value['_output']>, ZodMapDef<Key, Value>, Map<Key['_input'], Value['_input']>> {}
property create
static create: < Key_1 extends ZodTypeAny = ZodTypeAny, Value_1 extends ZodTypeAny = ZodTypeAny>( keyType: Key_1, valueType: Value_1, params?: RawCreateParams) => ZodMap<Key_1, Value_1>;
property keySchema
readonly keySchema: ZodType<any, any, any>;
property valueSchema
readonly valueSchema: ZodType<any, any, any>;
class ZodNaN
class ZodNaN extends ZodType<number, ZodNaNDef, number> {}
property create
static create: (params?: RawCreateParams) => ZodNaN;
class ZodNativeEnum
class ZodNativeEnum<T extends EnumLike> extends ZodType< T[keyof T], ZodNativeEnumDef<T>, T[keyof T]> {}
class ZodNever
class ZodNever extends ZodType<never, ZodNeverDef, never> {}
property create
static create: (params?: RawCreateParams) => ZodNever;
class ZodNull
class ZodNull extends ZodType<null, ZodNullDef, null> {}
property create
static create: (params?: RawCreateParams) => ZodNull;
class ZodNullable
class ZodNullable<T extends ZodTypeAny> extends ZodType< T['_output'] | null, ZodNullableDef<T>, T['_input'] | null> {}
class ZodNumber
class ZodNumber extends ZodType<number, ZodNumberDef, number> {}
property create
static create: (params?: RawCreateParams & { coerce?: boolean }) => ZodNumber;
property isFinite
readonly isFinite: boolean;
property isInt
readonly isInt: boolean;
property max
max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
property maxValue
readonly maxValue: number;
property min
min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
property minValue
readonly minValue: number;
property step
step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method finite
finite: (message?: errorUtil.ErrMessage) => ZodNumber;
method gt
gt: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method gte
gte: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method int
int: (message?: errorUtil.ErrMessage) => ZodNumber;
method lt
lt: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method lte
lte: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method multipleOf
multipleOf: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method negative
negative: (message?: errorUtil.ErrMessage) => ZodNumber;
method nonnegative
nonnegative: (message?: errorUtil.ErrMessage) => ZodNumber;
method nonpositive
nonpositive: (message?: errorUtil.ErrMessage) => ZodNumber;
method positive
positive: (message?: errorUtil.ErrMessage) => ZodNumber;
method safe
safe: (message?: errorUtil.ErrMessage) => ZodNumber;
method setLimit
protected setLimit: ( kind: 'min' | 'max', value: number, inclusive: boolean, message?: string) => ZodNumber;
class ZodObject
class ZodObject< T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {}
property augment
augment: <Augmentation extends ZodRawShape>( augmentation: Augmentation) => ZodObject< objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall, objectOutputType< objectUtil.extendShape<T, Augmentation>, Catchall, UnknownKeys >, objectInputType< objectUtil.extendShape<T, Augmentation>, Catchall, UnknownKeys >>;
Deprecated
Use
.extend
instead
property create
static create: <T_1 extends ZodRawShape>( shape: T_1, params?: RawCreateParams) => ZodObject< T_1, 'strip', ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks< baseObjectOutputType<T_1>, any >[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1] } : never>;
property lazycreate
static lazycreate: <T_1 extends ZodRawShape>( shape: () => T_1, params?: RawCreateParams) => ZodObject< T_1, 'strip', ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks< baseObjectOutputType<T_1>, any >[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1] } : never>;
property nonstrict
nonstrict: () => ZodObject<T, 'passthrough', Catchall>;
Deprecated
In most cases, this is no longer needed - unknown properties are now silently stripped. If you want to pass through unknown properties, use
.passthrough()
instead.
property shape
readonly shape: ZodRawShape;
property strictCreate
static strictCreate: <T_1 extends ZodRawShape>( shape: T_1, params?: RawCreateParams) => ZodObject< T_1, 'strict', ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks< baseObjectOutputType<T_1>, any >[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1] } : never>;
method catchall
catchall: <Index extends ZodTypeAny>( index: Index) => ZodObject<T, UnknownKeys, Index>;
method deepPartial
deepPartial: () => partialUtil.DeepPartial<this>;
Deprecated
method extend
extend: <Augmentation extends ZodRawShape>( augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
method keyof
keyof: () => ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
method merge
merge: <Incoming extends AnyZodObject, Augmentation extends Incoming['shape']>( merging: Incoming) => ZodObject< objectUtil.extendShape<T, Augmentation>, Incoming['_def']['unknownKeys'], Incoming['_def']['catchall']>;
Prior to zod@1.0.12 there was a bug in the inferred type of merged objects. Please upgrade if you are experiencing issues.
method omit
omit: <Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>( mask: Mask) => ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
method partial
partial: { (): ZodObject< { [k in keyof T]: ZodOptional<T[k]> }, UnknownKeys, Catchall, objectOutputType< { [k in keyof T]: ZodOptional<T[k]> }, Catchall, UnknownKeys >, objectInputType< { [k in keyof T]: ZodOptional<T[k]> }, Catchall, UnknownKeys > >; <Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>( mask: Mask ): ZodObject< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }[k] : never; }, UnknownKeys, Catchall, objectOutputType< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }[k] : never; }, Catchall, UnknownKeys >, objectInputType< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }[k] : never; }, Catchall, UnknownKeys > >;};
method passthrough
passthrough: () => ZodObject<T, 'passthrough', Catchall>;
method pick
pick: <Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>( mask: Mask) => ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
method required
required: { (): ZodObject< { [k in keyof T]: deoptional<T[k]> }, UnknownKeys, Catchall, objectOutputType< { [k in keyof T]: deoptional<T[k]> }, Catchall, UnknownKeys >, objectInputType< { [k in keyof T]: deoptional<T[k]> }, Catchall, UnknownKeys > >; <Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>( mask: Mask ): ZodObject< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }[k] : never; }, UnknownKeys, Catchall, objectOutputType< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }[k] : never; }, Catchall, UnknownKeys >, objectInputType< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }[k] : never; }, Catchall, UnknownKeys > >;};
method setKey
setKey: <Key extends string, Schema extends ZodTypeAny>( key: Key, schema: Schema) => ZodObject< T & { [k in Key]: Schema }, UnknownKeys, Catchall, objectOutputType<T & { [k in Key]: Schema }, Catchall, UnknownKeys>, objectInputType<T & { [k in Key]: Schema }, Catchall, UnknownKeys>>;
method strict
strict: (message?: errorUtil.ErrMessage) => ZodObject<T, 'strict', Catchall>;
method strip
strip: () => ZodObject<T, 'strip', Catchall>;
class ZodOptional
class ZodOptional<T extends ZodTypeAny> extends ZodType< T['_output'] | undefined, ZodOptionalDef<T>, T['_input'] | undefined> {}
class ZodPipeline
class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType< B['_output'], ZodPipelineDef<A, B>, A['_input']> {}
method create
static create: <A extends ZodTypeAny, B extends ZodTypeAny>( a: A, b: B) => ZodPipeline<A, B>;
class ZodPromise
class ZodPromise<T extends ZodTypeAny> extends ZodType< Promise<T['_output']>, ZodPromiseDef<T>, Promise<T['_input']>> {}
class ZodReadonly
class ZodReadonly<T extends ZodTypeAny> extends ZodType< MakeReadonly<T['_output']>, ZodReadonlyDef<T>, MakeReadonly<T['_input']>> {}
class ZodRecord
class ZodRecord< Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodType< RecordType<Key['_output'], Value['_output']>, ZodRecordDef<Key, Value>, RecordType<Key['_input'], Value['_input']>> {}
property element
readonly element: ZodType<any, any, any>;
property keySchema
readonly keySchema: ZodType<string | number | symbol, any, any>;
property valueSchema
readonly valueSchema: ZodType<any, any, any>;
method create
static create: { <Value extends ZodTypeAny>( valueType: Value, params?: RawCreateParams ): ZodRecord<ZodString, Value>; <Keys extends KeySchema, Value extends ZodTypeAny>( keySchema: Keys, valueType: Value, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodRecord<Keys, Value>;};
class ZodSchema
abstract class ZodType< Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {}
constructor
constructor(def: ZodTypeDef);
property "~standard"
'~standard': StandardSchemaV1.Props<Input, Output>;
property description
readonly description: string;
property spa
spa: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
Alias of safeParseAsync
method "~validate"
'~validate': ( data: unknown) => StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
method and
and: <T extends ZodTypeAny>(incoming: T) => ZodIntersection<this, T>;
method array
array: () => ZodArray<this>;
method brand
brand: <B extends string | number | symbol>(brand?: B) => ZodBranded<this, B>;
method catch
catch: { (def: Output): ZodCatch<this>; ( def: (ctx: { error: ZodError<any>; input: Input }) => Output ): ZodCatch<this>;};
method default
default: { (def: util.noUndefined<Input>): ZodDefault<this>; (def: () => util.noUndefined<Input>): ZodDefault<this>;};
method describe
describe: (description: string) => this;
method isNullable
isNullable: () => boolean;
method isOptional
isOptional: () => boolean;
method nullable
nullable: () => ZodNullable<this>;
method nullish
nullish: () => ZodOptional<ZodNullable<this>>;
method optional
optional: () => ZodOptional<this>;
method or
or: <T extends ZodTypeAny>(option: T) => ZodUnion<[this, T]>;
method parse
parse: (data: unknown, params?: Partial<ParseParams>) => Output;
method parseAsync
parseAsync: (data: unknown, params?: Partial<ParseParams>) => Promise<Output>;
method pipe
pipe: <T extends ZodTypeAny>(target: T) => ZodPipeline<this, T>;
method promise
promise: () => ZodPromise<this>;
method readonly
readonly: () => ZodReadonly<this>;
method refine
refine: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => CustomErrorParams) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => unknown, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => Partial<util.Omit<ZodCustomIssue, 'code'>>) ): ZodEffects<this, Output, Input>;};
method refinement
refinement: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => boolean, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, Output, Input>;};
method safeParse
safeParse: ( data: unknown, params?: Partial<ParseParams>) => SafeParseReturnType<Input, Output>;
method safeParseAsync
safeParseAsync: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
method superRefine
superRefine: { <RefinedOutput extends Output>( refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput ): ZodEffects<this, RefinedOutput, Input>; (refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects< this, Output, Input >; (refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects< this, Output, Input >;};
method transform
transform: <NewOut>( transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>) => ZodEffects<this, NewOut>;
class ZodSet
class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType< Set<Value['_output']>, ZodSetDef<Value>, Set<Value['_input']>> {}
property create
static create: <Value_1 extends ZodTypeAny = ZodTypeAny>( valueType: Value_1, params?: RawCreateParams) => ZodSet<Value_1>;
method max
max: (maxSize: number, message?: errorUtil.ErrMessage) => this;
method min
min: (minSize: number, message?: errorUtil.ErrMessage) => this;
method nonempty
nonempty: (message?: errorUtil.ErrMessage) => ZodSet<Value>;
method size
size: (size: number, message?: errorUtil.ErrMessage) => this;
class ZodString
class ZodString extends ZodType<string, ZodStringDef, string> {}
property create
static create: (params?: RawCreateParams & { coerce?: true }) => ZodString;
property isBase64
readonly isBase64: boolean;
property isBase64url
readonly isBase64url: boolean;
property isCIDR
readonly isCIDR: boolean;
property isCUID
readonly isCUID: boolean;
property isCUID2
readonly isCUID2: boolean;
property isDate
readonly isDate: boolean;
property isDatetime
readonly isDatetime: boolean;
property isDuration
readonly isDuration: boolean;
property isEmail
readonly isEmail: boolean;
property isEmoji
readonly isEmoji: boolean;
property isIP
readonly isIP: boolean;
property isNANOID
readonly isNANOID: boolean;
property isTime
readonly isTime: boolean;
property isULID
readonly isULID: boolean;
property isURL
readonly isURL: boolean;
property isUUID
readonly isUUID: boolean;
property maxLength
readonly maxLength: number;
property minLength
readonly minLength: number;
method base64
base64: (message?: errorUtil.ErrMessage) => ZodString;
method base64url
base64url: (message?: errorUtil.ErrMessage) => ZodString;
method cidr
cidr: ( options?: string | { version?: IpVersion; message?: string }) => ZodString;
method cuid
cuid: (message?: errorUtil.ErrMessage) => ZodString;
method cuid2
cuid2: (message?: errorUtil.ErrMessage) => ZodString;
method date
date: (message?: string) => ZodString;
method datetime
datetime: ( options?: | string | { message?: string | undefined; precision?: number | null; offset?: boolean; local?: boolean; }) => ZodString;
method duration
duration: (message?: errorUtil.ErrMessage) => ZodString;
method email
email: (message?: errorUtil.ErrMessage) => ZodString;
method emoji
emoji: (message?: errorUtil.ErrMessage) => ZodString;
method endsWith
endsWith: (value: string, message?: errorUtil.ErrMessage) => ZodString;
method includes
includes: ( value: string, options?: { message?: string; position?: number }) => ZodString;
method ip
ip: (options?: string | { version?: IpVersion; message?: string }) => ZodString;
method jwt
jwt: (options?: { alg?: string; message?: string }) => ZodString;
method length
length: (len: number, message?: errorUtil.ErrMessage) => ZodString;
method max
max: (maxLength: number, message?: errorUtil.ErrMessage) => ZodString;
method min
min: (minLength: number, message?: errorUtil.ErrMessage) => ZodString;
method nanoid
nanoid: (message?: errorUtil.ErrMessage) => ZodString;
method nonempty
nonempty: (message?: errorUtil.ErrMessage) => ZodString;
Equivalent to
.min(1)
method regex
regex: (regex: RegExp, message?: errorUtil.ErrMessage) => ZodString;
method startsWith
startsWith: (value: string, message?: errorUtil.ErrMessage) => ZodString;
method time
time: ( options?: | string | { message?: string | undefined; precision?: number | null }) => ZodString;
method toLowerCase
toLowerCase: () => ZodString;
method toUpperCase
toUpperCase: () => ZodString;
method trim
trim: () => ZodString;
method ulid
ulid: (message?: errorUtil.ErrMessage) => ZodString;
method url
url: (message?: errorUtil.ErrMessage) => ZodString;
method uuid
uuid: (message?: errorUtil.ErrMessage) => ZodString;
class ZodSymbol
class ZodSymbol extends ZodType<symbol, ZodSymbolDef, symbol> {}
property create
static create: (params?: RawCreateParams) => ZodSymbol;
class ZodTransformer
class ZodEffects< T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {}
property create
static create: <I extends ZodTypeAny>( schema: I, effect: Effect<I['_output']>, params?: RawCreateParams) => ZodEffects<I, I['_output'], input<I>>;
property createWithPreprocess
static createWithPreprocess: <I extends ZodTypeAny>( preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I['_output'], unknown>;
method innerType
innerType: () => T;
method sourceType
sourceType: () => T;
class ZodTuple
class ZodTuple< T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> extends ZodType< OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {}
class ZodType
abstract class ZodType< Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {}
constructor
constructor(def: ZodTypeDef);
property "~standard"
'~standard': StandardSchemaV1.Props<Input, Output>;
property description
readonly description: string;
property spa
spa: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
Alias of safeParseAsync
method "~validate"
'~validate': ( data: unknown) => StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
method and
and: <T extends ZodTypeAny>(incoming: T) => ZodIntersection<this, T>;
method array
array: () => ZodArray<this>;
method brand
brand: <B extends string | number | symbol>(brand?: B) => ZodBranded<this, B>;
method catch
catch: { (def: Output): ZodCatch<this>; ( def: (ctx: { error: ZodError<any>; input: Input }) => Output ): ZodCatch<this>;};
method default
default: { (def: util.noUndefined<Input>): ZodDefault<this>; (def: () => util.noUndefined<Input>): ZodDefault<this>;};
method describe
describe: (description: string) => this;
method isNullable
isNullable: () => boolean;
method isOptional
isOptional: () => boolean;
method nullable
nullable: () => ZodNullable<this>;
method nullish
nullish: () => ZodOptional<ZodNullable<this>>;
method optional
optional: () => ZodOptional<this>;
method or
or: <T extends ZodTypeAny>(option: T) => ZodUnion<[this, T]>;
method parse
parse: (data: unknown, params?: Partial<ParseParams>) => Output;
method parseAsync
parseAsync: (data: unknown, params?: Partial<ParseParams>) => Promise<Output>;
method pipe
pipe: <T extends ZodTypeAny>(target: T) => ZodPipeline<this, T>;
method promise
promise: () => ZodPromise<this>;
method readonly
readonly: () => ZodReadonly<this>;
method refine
refine: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => CustomErrorParams) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => unknown, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => Partial<util.Omit<ZodCustomIssue, 'code'>>) ): ZodEffects<this, Output, Input>;};
method refinement
refinement: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => boolean, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, Output, Input>;};
method safeParse
safeParse: ( data: unknown, params?: Partial<ParseParams>) => SafeParseReturnType<Input, Output>;
method safeParseAsync
safeParseAsync: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
method superRefine
superRefine: { <RefinedOutput extends Output>( refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput ): ZodEffects<this, RefinedOutput, Input>; (refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects< this, Output, Input >; (refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects< this, Output, Input >;};
method transform
transform: <NewOut>( transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>) => ZodEffects<this, NewOut>;
class ZodUndefined
class ZodUndefined extends ZodType<undefined, ZodUndefinedDef, undefined> {}
class ZodUnion
class ZodUnion<T extends ZodUnionOptions> extends ZodType< T[number]['_output'], ZodUnionDef<T>, T[number]['_input']> {}
class ZodUnknown
class ZodUnknown extends ZodType<unknown, ZodUnknownDef, unknown> {}
property create
static create: (params?: RawCreateParams) => ZodUnknown;
Interfaces
interface ParseContext
interface ParseContext {}
property common
readonly common: { readonly issues: ZodIssue[]; readonly contextualErrorMap?: ZodErrorMap; readonly async: boolean;};
property data
readonly data: any;
property parent
readonly parent: ParseContext | null;
property parsedType
readonly parsedType: ZodParsedType;
property path
readonly path: ParsePath;
property schemaErrorMap
readonly schemaErrorMap?: ZodErrorMap;
interface ParseResult
interface ParseResult {}
interface RefinementCtx
interface RefinementCtx {}
interface ZodAnyDef
interface ZodAnyDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodAny;
interface ZodArrayDef
interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
property exactLength
exactLength: { value: number; message?: string;} | null;
property maxLength
maxLength: { value: number; message?: string;} | null;
property minLength
minLength: { value: number; message?: string;} | null;
property type
type: T;
property typeName
typeName: ZodFirstPartyTypeKind.ZodArray;
interface ZodBigIntDef
interface ZodBigIntDef extends ZodTypeDef {}
interface ZodBooleanDef
interface ZodBooleanDef extends ZodTypeDef {}
interface ZodBrandedDef
interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {}
interface ZodCatchDef
interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
property catchValue
catchValue: (ctx: { error: ZodError; input: unknown }) => T['_input'];
property innerType
innerType: T;
property typeName
typeName: ZodFirstPartyTypeKind.ZodCatch;
interface ZodCustomIssue
interface ZodCustomIssue extends ZodIssueBase {}
interface ZodDateDef
interface ZodDateDef extends ZodTypeDef {}
interface ZodDefaultDef
interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
property defaultValue
defaultValue: () => util.noUndefined<T['_input']>;
property innerType
innerType: T;
property typeName
typeName: ZodFirstPartyTypeKind.ZodDefault;
interface ZodDiscriminatedUnionDef
interface ZodDiscriminatedUnionDef< Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<string>[] = ZodDiscriminatedUnionOption<string>[]> extends ZodTypeDef {}
property discriminator
discriminator: Discriminator;
property options
options: Options;
property optionsMap
optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
property typeName
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion;
interface ZodEffectsDef
interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodEnumDef
interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {}
interface ZodFunctionDef
interface ZodFunctionDef< Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodIntersectionDef
interface ZodIntersectionDef< T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodInvalidArgumentsIssue
interface ZodInvalidArgumentsIssue extends ZodIssueBase {}
property argumentsError
argumentsError: ZodError;
property code
code: typeof ZodIssueCode.invalid_arguments;
interface ZodInvalidDateIssue
interface ZodInvalidDateIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_date;
interface ZodInvalidEnumValueIssue
interface ZodInvalidEnumValueIssue extends ZodIssueBase {}
interface ZodInvalidIntersectionTypesIssue
interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_intersection_types;
interface ZodInvalidLiteralIssue
interface ZodInvalidLiteralIssue extends ZodIssueBase {}
interface ZodInvalidReturnTypeIssue
interface ZodInvalidReturnTypeIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_return_type;
property returnTypeError
returnTypeError: ZodError;
interface ZodInvalidStringIssue
interface ZodInvalidStringIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_string;
property validation
validation: StringValidation;
interface ZodInvalidTypeIssue
interface ZodInvalidTypeIssue extends ZodIssueBase {}
interface ZodInvalidUnionDiscriminatorIssue
interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {}
interface ZodInvalidUnionIssue
interface ZodInvalidUnionIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_union;
property unionErrors
unionErrors: ZodError[];
interface ZodLazyDef
interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodLiteralDef
interface ZodLiteralDef<T = any> extends ZodTypeDef {}
interface ZodMapDef
interface ZodMapDef< Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodNaNDef
interface ZodNaNDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodNaN;
interface ZodNativeEnumDef
interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {}
interface ZodNeverDef
interface ZodNeverDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodNever;
interface ZodNotFiniteIssue
interface ZodNotFiniteIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.not_finite;
interface ZodNotMultipleOfIssue
interface ZodNotMultipleOfIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.not_multiple_of;
property multipleOf
multipleOf: number | bigint;
interface ZodNullableDef
interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodNullDef
interface ZodNullDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodNull;
interface ZodNumberDef
interface ZodNumberDef extends ZodTypeDef {}
interface ZodObjectDef
interface ZodObjectDef< T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
property catchall
catchall: Catchall;
property shape
shape: () => T;
property typeName
typeName: ZodFirstPartyTypeKind.ZodObject;
property unknownKeys
unknownKeys: UnknownKeys;
interface ZodOptionalDef
interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodPipelineDef
interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {}
interface ZodPromiseDef
interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodReadonlyDef
interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodRecordDef
interface ZodRecordDef< Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodSetDef
interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodStringDef
interface ZodStringDef extends ZodTypeDef {}
interface ZodSymbolDef
interface ZodSymbolDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodSymbol;
interface ZodTooBigIssue
interface ZodTooBigIssue extends ZodIssueBase {}
interface ZodTooSmallIssue
interface ZodTooSmallIssue extends ZodIssueBase {}
interface ZodTupleDef
interface ZodTupleDef< T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {}
interface ZodTypeDef
interface ZodTypeDef {}
property description
description?: string;
property errorMap
errorMap?: ZodErrorMap;
interface ZodUndefinedDef
interface ZodUndefinedDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodUndefined;
interface ZodUnionDef
interface ZodUnionDef< T extends ZodUnionOptions = Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>> extends ZodTypeDef {}
interface ZodUnknownDef
interface ZodUnknownDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodUnknown;
interface ZodUnrecognizedKeysIssue
interface ZodUnrecognizedKeysIssue extends ZodIssueBase {}
interface ZodVoidDef
interface ZodVoidDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodVoid;
Enums
enum ZodFirstPartyTypeKind
enum ZodFirstPartyTypeKind { ZodString = 'ZodString', ZodNumber = 'ZodNumber', ZodNaN = 'ZodNaN', ZodBigInt = 'ZodBigInt', ZodBoolean = 'ZodBoolean', ZodDate = 'ZodDate', ZodSymbol = 'ZodSymbol', ZodUndefined = 'ZodUndefined', ZodNull = 'ZodNull', ZodAny = 'ZodAny', ZodUnknown = 'ZodUnknown', ZodNever = 'ZodNever', ZodVoid = 'ZodVoid', ZodArray = 'ZodArray', ZodObject = 'ZodObject', ZodUnion = 'ZodUnion', ZodDiscriminatedUnion = 'ZodDiscriminatedUnion', ZodIntersection = 'ZodIntersection', ZodTuple = 'ZodTuple', ZodRecord = 'ZodRecord', ZodMap = 'ZodMap', ZodSet = 'ZodSet', ZodFunction = 'ZodFunction', ZodLazy = 'ZodLazy', ZodLiteral = 'ZodLiteral', ZodEnum = 'ZodEnum', ZodEffects = 'ZodEffects', ZodNativeEnum = 'ZodNativeEnum', ZodOptional = 'ZodOptional', ZodNullable = 'ZodNullable', ZodDefault = 'ZodDefault', ZodCatch = 'ZodCatch', ZodPromise = 'ZodPromise', ZodBranded = 'ZodBranded', ZodPipeline = 'ZodPipeline', ZodReadonly = 'ZodReadonly',}
member ZodAny
ZodAny = 'ZodAny'
member ZodArray
ZodArray = 'ZodArray'
member ZodBigInt
ZodBigInt = 'ZodBigInt'
member ZodBoolean
ZodBoolean = 'ZodBoolean'
member ZodBranded
ZodBranded = 'ZodBranded'
member ZodCatch
ZodCatch = 'ZodCatch'
member ZodDate
ZodDate = 'ZodDate'
member ZodDefault
ZodDefault = 'ZodDefault'
member ZodDiscriminatedUnion
ZodDiscriminatedUnion = 'ZodDiscriminatedUnion'
member ZodEffects
ZodEffects = 'ZodEffects'
member ZodEnum
ZodEnum = 'ZodEnum'
member ZodFunction
ZodFunction = 'ZodFunction'
member ZodIntersection
ZodIntersection = 'ZodIntersection'
member ZodLazy
ZodLazy = 'ZodLazy'
member ZodLiteral
ZodLiteral = 'ZodLiteral'
member ZodMap
ZodMap = 'ZodMap'
member ZodNaN
ZodNaN = 'ZodNaN'
member ZodNativeEnum
ZodNativeEnum = 'ZodNativeEnum'
member ZodNever
ZodNever = 'ZodNever'
member ZodNull
ZodNull = 'ZodNull'
member ZodNullable
ZodNullable = 'ZodNullable'
member ZodNumber
ZodNumber = 'ZodNumber'
member ZodObject
ZodObject = 'ZodObject'
member ZodOptional
ZodOptional = 'ZodOptional'
member ZodPipeline
ZodPipeline = 'ZodPipeline'
member ZodPromise
ZodPromise = 'ZodPromise'
member ZodReadonly
ZodReadonly = 'ZodReadonly'
member ZodRecord
ZodRecord = 'ZodRecord'
member ZodSet
ZodSet = 'ZodSet'
member ZodString
ZodString = 'ZodString'
member ZodSymbol
ZodSymbol = 'ZodSymbol'
member ZodTuple
ZodTuple = 'ZodTuple'
member ZodUndefined
ZodUndefined = 'ZodUndefined'
member ZodUnion
ZodUnion = 'ZodUnion'
member ZodUnknown
ZodUnknown = 'ZodUnknown'
member ZodVoid
ZodVoid = 'ZodVoid'
Type Aliases
type AnyZodObject
type AnyZodObject = ZodObject<any, any, any>;
type AnyZodTuple
type AnyZodTuple = ZodTuple<[ZodTypeAny, ...ZodTypeAny[]] | [], ZodTypeAny | null>;
type ArrayCardinality
type ArrayCardinality = 'many' | 'atleastone';
type ArrayKeys
type ArrayKeys = keyof any[];
type arrayOutputType
type arrayOutputType< T extends ZodTypeAny, Cardinality extends ArrayCardinality = 'many'> = Cardinality extends 'atleastone' ? [T['_output'], ...T['_output'][]] : T['_output'][];
type AssertArray
type AssertArray<T> = T extends any[] ? T : never;
type AsyncParseReturnType
type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
type baseObjectInputType
type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{ [k in keyof Shape]: Shape[k]['_input'];}>;
type baseObjectOutputType
type baseObjectOutputType<Shape extends ZodRawShape> = { [k in keyof Shape]: Shape[k]['_output'];};
type BRAND
type BRAND<T extends string | number | symbol> = { [BRAND]: { [k in T]: true; };};
type CatchallInput
type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : { [k: string]: T['_input']; };
type CatchallOutput
type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : { [k: string]: T['_output']; };
type CustomErrorParams
type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, 'code'>>;
type DenormalizedError
type DenormalizedError = { [k: string]: DenormalizedError | string[];};
type deoptional
type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
type DIRTY
type DIRTY<T> = { status: 'dirty'; value: T;};
type Effect
type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
type EnumLike
type EnumLike = { [k: string]: string | number; [nu: number]: string;};
type EnumValues
type EnumValues<T extends string = string> = readonly [T, ...T[]];
type ErrorMapCtx
type ErrorMapCtx = { defaultError: string; data: any;};
type FilterEnum
type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
type Indices
type Indices<T> = Exclude<keyof T, ArrayKeys>;
type infer
type TypeOf<T extends ZodType<any, any, any>> = T['_output'];
type inferFlattenedErrors
type inferFlattenedErrors< T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
type inferFormattedError
type inferFormattedError< T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
type InnerTypeOfFunction
type InnerTypeOfFunction< Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args['_output'] extends Array<any> ? (...args: Args['_output']) => Returns['_input'] : never;
type input
type input<T extends ZodType<any, any, any>> = T['_input'];
type InputTypeOfTuple
type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]['_input'] : never;}>;
type InputTypeOfTupleWithRest
type InputTypeOfTupleWithRest< T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest['_input'][]] : InputTypeOfTuple<T>;
type INVALID
type INVALID = { status: 'aborted';};
type IpVersion
type IpVersion = 'v4' | 'v6';
type IssueData
type IssueData = stripPath<ZodIssueOptionalMessage> & { path?: (string | number)[]; fatal?: boolean;};
type KeySchema
type KeySchema = ZodType<string | number | symbol, any, any>;
type mergeTypes
type mergeTypes<A, B> = { [k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;};
type noUnrecognized
type noUnrecognized<Obj extends object, Shape extends object> = { [k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;};
type objectInputType
type objectInputType< Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
type objectOutputType
type objectOutputType< Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
type ObjectPair
type ObjectPair = { key: SyncParseReturnType<any>; value: SyncParseReturnType<any>;};
type OK
type OK<T> = { status: 'valid'; value: T;};
type OuterTypeOfFunction
type OuterTypeOfFunction< Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args['_input'] extends Array<any> ? (...args: Args['_input']) => Returns['_output'] : never;
type output
type output<T extends ZodType<any, any, any>> = T['_output'];
type OutputTypeOfTuple
type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]['_output'] : never;}>;
type OutputTypeOfTupleWithRest
type OutputTypeOfTupleWithRest< T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest['_output'][]] : OutputTypeOfTuple<T>;
type ParseInput
type ParseInput = { data: any; path: (string | number)[]; parent: ParseContext;};
type ParseParams
type ParseParams = { path: (string | number)[]; errorMap: ZodErrorMap; async: boolean;};
type ParsePath
type ParsePath = ParsePathComponent[];
type ParsePathComponent
type ParsePathComponent = string | number;
type ParseReturnType
type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
type PassthroughType
type PassthroughType<T extends UnknownKeysParam> = T extends 'passthrough' ? { [k: string]: unknown; } : unknown;
type PreprocessEffect
type PreprocessEffect<T> = { type: 'preprocess'; transform: (arg: T, ctx: RefinementCtx) => any;};
type Primitive
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
type ProcessedCreateParams
type ProcessedCreateParams = { errorMap?: ZodErrorMap; description?: string;};
type RawCreateParams
type RawCreateParams = | { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } | undefined;
type RecordType
type RecordType<K extends string | number | symbol, 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 Refinement
type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
type RefinementEffect
type RefinementEffect<T> = { type: 'refinement'; refinement: (arg: T, ctx: RefinementCtx) => any;};
type SafeParseError
type SafeParseError<Input> = { success: false; error: ZodError<Input>; data?: never;};
type SafeParseReturnType
type SafeParseReturnType<Input, Output> = | SafeParseSuccess<Output> | SafeParseError<Input>;
type SafeParseSuccess
type SafeParseSuccess<Output> = { success: true; data: Output; error?: never;};
type Scalars
type Scalars = Primitive | Primitive[];
type SomeZodObject
type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
type StringValidation
type 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; };
type SuperRefinement
type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
type SyncParseReturnType
type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
type TransformEffect
type TransformEffect<T> = { type: 'transform'; transform: (arg: T, ctx: RefinementCtx) => any;};
type typecast
type typecast<A, T> = A extends T ? A : never;
type TypeOf
type TypeOf<T extends ZodType<any, any, any>> = T['_output'];
type typeToFlattenedError
type typeToFlattenedError<T, U = string> = { formErrors: U[]; fieldErrors: { [P in allKeys<T>]?: U[]; };};
type UnknownKeysParam
type UnknownKeysParam = 'passthrough' | 'strict' | 'strip';
type Values
type Values<T extends EnumValues> = { [k in T[number]]: k;};
type Writeable
type Writeable<T> = { -readonly [P in keyof T]: T[P];};
type ZodBigIntCheck
type ZodBigIntCheck = | { kind: 'min'; value: bigint; inclusive: boolean; message?: string; } | { kind: 'max'; value: bigint; inclusive: boolean; message?: string; } | { kind: 'multipleOf'; value: bigint; message?: string; };
type ZodDateCheck
type ZodDateCheck = | { kind: 'min'; value: number; message?: string; } | { kind: 'max'; value: number; message?: string; };
type ZodDiscriminatedUnionOption
type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject< { [key in Discriminator]: ZodTypeAny; } & ZodRawShape, UnknownKeysParam, ZodTypeAny>;
type ZodErrorMap
type ZodErrorMap = ( issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { message: string;};
type ZodFirstPartySchemaTypes
type 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;
type ZodFormattedError
type ZodFormattedError<T, U = string> = { _errors: U[];} & recursiveZodFormattedError<NonNullable<T>>;
type ZodIssue
type ZodIssue = ZodIssueOptionalMessage & { fatal?: boolean; message: string;};
type ZodIssueBase
type ZodIssueBase = { path: (string | number)[]; message?: string;};
type ZodIssueCode
type ZodIssueCode = keyof typeof ZodIssueCode;
type ZodIssueOptionalMessage
type ZodIssueOptionalMessage = | ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
type ZodNonEmptyArray
type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, 'atleastone'>;
type ZodNullableType
type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
type ZodNumberCheck
type ZodNumberCheck = | { kind: 'min'; value: number; inclusive: boolean; message?: string; } | { kind: 'max'; value: number; inclusive: boolean; message?: string; } | { kind: 'int'; message?: string; } | { kind: 'multipleOf'; value: number; message?: string; } | { kind: 'finite'; message?: string; };
type ZodOptionalType
type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
type ZodParsedType
type ZodParsedType = keyof typeof ZodParsedType;
type ZodRawShape
type ZodRawShape = { [k: string]: ZodTypeAny;};
type ZodStringCheck
type ZodStringCheck = | { kind: 'min'; value: number; message?: string; } | { kind: 'max'; value: number; message?: string; } | { kind: 'length'; value: number; message?: string; } | { 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'; value: string; position?: number; message?: string; } | { kind: 'cuid2'; message?: string; } | { kind: 'ulid'; message?: string; } | { kind: 'startsWith'; value: string; message?: string; } | { kind: 'endsWith'; value: string; message?: string; } | { kind: 'regex'; regex: RegExp; message?: string; } | { kind: 'trim'; message?: string; } | { kind: 'toLowerCase'; message?: string; } | { kind: 'toUpperCase'; message?: string; } | { kind: 'jwt'; alg?: string; message?: string; } | { kind: 'datetime'; offset: boolean; local: boolean; precision: number | null; message?: string; } | { kind: 'date'; message?: string; } | { kind: 'time'; precision: number | null; message?: string; } | { kind: 'duration'; message?: string; } | { kind: 'ip'; version?: IpVersion; message?: string; } | { kind: 'cidr'; version?: IpVersion; message?: string; } | { kind: 'base64'; message?: string; } | { kind: 'base64url'; message?: string; };
type ZodTupleItems
type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
type ZodTypeAny
type ZodTypeAny = ZodType<any, any, any>;
type ZodUnionOptions
type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
Namespaces
namespace objectUtil
namespace objectUtil {}
function mergeShapes
mergeShapes: <U, T>(first: U, second: T) => T & U;
type addQuestionMarks
type addQuestionMarks<T extends object, _O = any> = { [K in requiredKeys<T>]: T[K];} & { [K in optionalKeys<T>]?: T[K];} & { [k in keyof T]?: unknown;};
type extendShape
type extendShape<A extends object, B extends object> = keyof A & keyof B extends never ? A & B : { [K in keyof A as K extends keyof B ? never : K]: A[K]; } & { [K in keyof B]: B[K]; };
type flatten
type flatten<T> = identity<{ [k in keyof T]: T[k];}>;
type identity
type identity<T> = T;
type MergeShapes
type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : { [k in Exclude<keyof U, keyof V>]: U[k]; } & V;
type noNever
type noNever<T> = identity<{ [k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;}>;
type noNeverKeys
type noNeverKeys<T> = { [k in keyof T]: [T[k]] extends [never] ? never : k;}[keyof T];
namespace util
namespace util {}
variable isInteger
const isInteger: (number: unknown) => boolean;
variable objectKeys
const objectKeys: { (o: object): string[]; (o: {}): string[] };
function arrayToEnum
arrayToEnum: <T extends string, U extends [T, ...T[]]>( items: U) => { [k in U[number]]: k };
function assertEqual
assertEqual: <A, B>(val: AssertEqual<A, B>) => AssertEqual<A, B>;
function assertIs
assertIs: <T>(_arg: T) => void;
function assertNever
assertNever: (_x: never) => never;
function find
find: <T>(arr: T[], checker: (arg: T) => any) => T;
function getValidEnumValues
getValidEnumValues: (obj: any) => any[];
function joinValues
joinValues: <T extends any[]>(array: T, separator?: string) => string;
function jsonStringifyReplacer
jsonStringifyReplacer: (_: string, value: any) => any;
function objectValues
objectValues: (obj: any) => any[];
type Exactly
type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
type flatten
type flatten<T> = objectUtil.flatten<T>;
type identity
type identity<T> = objectUtil.identity<T>;
type isAny
type isAny<T> = 0 extends 1 & T ? true : false;
type MakePartial
type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
type noUndefined
type noUndefined<T> = T extends undefined ? never : T;
type Omit
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type OmitKeys
type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
namespace z
module 'lib/external.d.ts' {}
variable BRAND
const BRAND: Symbol;
variable coerce
const coerce: { string: (params?: RawCreateParams & { coerce?: true }) => ZodString; number: (params?: RawCreateParams & { coerce?: boolean }) => ZodNumber; boolean: (params?: RawCreateParams & { coerce?: boolean }) => ZodBoolean; bigint: (params?: RawCreateParams & { coerce?: boolean }) => ZodBigInt; date: (params?: RawCreateParams & { coerce?: boolean }) => ZodDate;};
variable defaultErrorMap
const defaultErrorMap: ZodErrorMap;
variable discriminatedUnion
const discriminatedUnion: < Discriminator extends string, Types extends readonly [ ZodDiscriminatedUnionOption<Discriminator>, ...ZodDiscriminatedUnionOption<Discriminator>[] ]>( discriminator: Discriminator, options: Types, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; }) => ZodDiscriminatedUnion<Discriminator, Types>;
variable EMPTY_PATH
const EMPTY_PATH: ParsePath;
variable enum
const enum: { <U extends string, T extends readonly [U, ...U[]]>(values: T, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; }): ZodEnum<Writeable<T>>; <U extends string, T extends [U, ...U[]]>(values: T, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; }): ZodEnum<T>; }
variable function
const function: { (): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>; <T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>; <T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>; <T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; }): ZodFunction<T, U>; }
variable INVALID
const INVALID: INVALID;
variable late
const late: { object: <T extends ZodRawShape>( shape: () => T, params?: RawCreateParams ) => ZodObject< T, 'strip', ZodTypeAny, { [k in keyof objectUtil.addQuestionMarks< baseObjectOutputType<T>, any >]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, any>[k]; }, { [k in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k] } >;};
variable NEVER
const NEVER: never;
variable pipeline
const pipeline: <A extends ZodTypeAny, B extends ZodTypeAny>( a: A, b: B) => ZodPipeline<A, B>;
variable record
const record: { <Value extends ZodTypeAny>( valueType: Value, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodRecord<ZodString, Value>; <Keys extends KeySchema, Value extends ZodTypeAny>( keySchema: Keys, valueType: Value, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodRecord<Keys, Value>;};
variable ZodIssueCode
const ZodIssueCode: { invalid_type: 'invalid_type'; invalid_literal: 'invalid_literal'; custom: 'custom'; invalid_union: 'invalid_union'; invalid_union_discriminator: 'invalid_union_discriminator'; invalid_enum_value: 'invalid_enum_value'; unrecognized_keys: 'unrecognized_keys'; invalid_arguments: 'invalid_arguments'; invalid_return_type: 'invalid_return_type'; invalid_date: 'invalid_date'; invalid_string: 'invalid_string'; too_small: 'too_small'; too_big: 'too_big'; invalid_intersection_types: 'invalid_intersection_types'; not_multiple_of: 'not_multiple_of'; not_finite: 'not_finite';};
variable ZodParsedType
const ZodParsedType: { string: 'string'; number: 'number'; bigint: 'bigint'; boolean: 'boolean'; symbol: 'symbol'; undefined: 'undefined'; object: 'object'; function: 'function'; map: 'map'; nan: 'nan'; integer: 'integer'; float: 'float'; date: 'date'; null: 'null'; array: 'array'; unknown: 'unknown'; promise: 'promise'; void: 'void'; never: 'never'; set: 'set';};
function addIssueToContext
addIssueToContext: (ctx: ParseContext, issueData: IssueData) => void;
function any
any: (params?: RawCreateParams) => ZodAny;
function array
array: <T extends ZodTypeAny>( schema: T, params?: RawCreateParams) => ZodArray<T, 'many'>;
function bigint
bigint: (params?: RawCreateParams & { coerce?: boolean }) => ZodBigInt;
function boolean
boolean: (params?: RawCreateParams & { coerce?: boolean }) => ZodBoolean;
function custom
custom: <T>( check?: (data: any) => any, _params?: string | CustomParams | ((input: any) => CustomParams), fatal?: boolean) => ZodType<T, ZodTypeDef, T>;
function date
date: (params?: RawCreateParams & { coerce?: boolean }) => ZodDate;
function datetimeRegex
datetimeRegex: (args: { precision?: number | null; offset?: boolean; local?: boolean;}) => RegExp;
function DIRTY
DIRTY: <T>(value: T) => DIRTY<T>;
function effect
effect: <I extends ZodTypeAny>( schema: I, effect: Effect<I['_output']>, params?: RawCreateParams) => ZodEffects<I, I['_output'], input<I>>;
function getErrorMap
getErrorMap: () => ZodErrorMap;
function getParsedType
getParsedType: (data: any) => ZodParsedType;
function instanceof
instanceof: <T extends typeof Class>(cls: T, params?: CustomParams) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>
function intersection
intersection: <T extends ZodTypeAny, U extends ZodTypeAny>( left: T, right: U, params?: RawCreateParams) => ZodIntersection<T, U>;
function isAborted
isAborted: (x: ParseReturnType<any>) => x is INVALID;
function isAsync
isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
function isDirty
isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
function isValid
isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
function lazy
lazy: <T extends ZodTypeAny>( getter: () => T, params?: RawCreateParams) => ZodLazy<T>;
function literal
literal: <T extends Primitive>( value: T, params?: RawCreateParams) => ZodLiteral<T>;
function makeIssue
makeIssue: (params: { data: any; path: (string | number)[]; errorMaps: ZodErrorMap[]; issueData: IssueData;}) => ZodIssue;
function map
map: < Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>( keyType: Key, valueType: Value, params?: RawCreateParams) => ZodMap<Key, Value>;
function nan
nan: (params?: RawCreateParams) => ZodNaN;
function nativeEnum
nativeEnum: <T extends EnumLike>( values: T, params?: RawCreateParams) => ZodNativeEnum<T>;
function never
never: (params?: RawCreateParams) => ZodNever;
function null
null: (params?: RawCreateParams) => ZodNull
function nullable
nullable: <T extends ZodTypeAny>( type: T, params?: RawCreateParams) => ZodNullable<T>;
function number
number: (params?: RawCreateParams & { coerce?: boolean }) => ZodNumber;
function object
object: <T extends ZodRawShape>( shape: T, params?: RawCreateParams) => ZodObject< T, 'strip', ZodTypeAny, { [k in keyof objectUtil.addQuestionMarks< baseObjectOutputType<T>, any >]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, any>[k]; }, { [k in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k] }>;
function oboolean
oboolean: () => ZodOptional<ZodBoolean>;
function OK
OK: <T>(value: T) => OK<T>;
function onumber
onumber: () => ZodOptional<ZodNumber>;
function optional
optional: <T extends ZodTypeAny>( type: T, params?: RawCreateParams) => ZodOptional<T>;
function ostring
ostring: () => ZodOptional<ZodString>;
function preprocess
preprocess: <I extends ZodTypeAny>( preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I['_output'], unknown>;
function promise
promise: <T extends ZodTypeAny>( schema: T, params?: RawCreateParams) => ZodPromise<T>;
function quotelessJson
quotelessJson: (obj: any) => string;
function set
set: <Value extends ZodTypeAny = ZodTypeAny>( valueType: Value, params?: RawCreateParams) => ZodSet<Value>;
function setErrorMap
setErrorMap: (map: ZodErrorMap) => void;
function strictObject
strictObject: <T extends ZodRawShape>( shape: T, params?: RawCreateParams) => ZodObject< T, 'strict', ZodTypeAny, { [k in keyof objectUtil.addQuestionMarks< baseObjectOutputType<T>, any >]: objectUtil.addQuestionMarks<baseObjectOutputType<T>, any>[k]; }, { [k in keyof baseObjectInputType<T>]: baseObjectInputType<T>[k] }>;
function string
string: (params?: RawCreateParams & { coerce?: true }) => ZodString;
function symbol
symbol: (params?: RawCreateParams) => ZodSymbol;
function transformer
transformer: <I extends ZodTypeAny>( schema: I, effect: Effect<I['_output']>, params?: RawCreateParams) => ZodEffects<I, I['_output'], input<I>>;
function tuple
tuple: <T extends [] | [ZodTypeAny, ...ZodTypeAny[]]>( schemas: T, params?: RawCreateParams) => ZodTuple<T, null>;
function undefined
undefined: (params?: RawCreateParams) => ZodUndefined;
function union
union: <T extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>( types: T, params?: RawCreateParams) => ZodUnion<T>;
function unknown
unknown: (params?: RawCreateParams) => ZodUnknown;
function void
void: (params?: RawCreateParams) => ZodVoid
class ParseStatus
class ParseStatus {}
property value
value: 'aborted' | 'dirty' | 'valid';
method abort
abort: () => void;
method dirty
dirty: () => void;
method mergeArray
static mergeArray: ( status: ParseStatus, results: SyncParseReturnType<any>[]) => SyncParseReturnType;
method mergeObjectAsync
static mergeObjectAsync: ( status: ParseStatus, pairs: { key: ParseReturnType<any>; value: ParseReturnType<any> }[]) => Promise<SyncParseReturnType<any>>;
method mergeObjectSync
static mergeObjectSync: ( status: ParseStatus, pairs: { key: SyncParseReturnType<any>; value: SyncParseReturnType<any>; alwaysSet?: boolean; }[]) => SyncParseReturnType;
class Schema
abstract class ZodType< Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {}
constructor
constructor(def: ZodTypeDef);
property "~standard"
'~standard': StandardSchemaV1.Props<Input, Output>;
property description
readonly description: string;
property spa
spa: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
Alias of safeParseAsync
method "~validate"
'~validate': ( data: unknown) => StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
method and
and: <T extends ZodTypeAny>(incoming: T) => ZodIntersection<this, T>;
method array
array: () => ZodArray<this>;
method brand
brand: <B extends string | number | symbol>(brand?: B) => ZodBranded<this, B>;
method catch
catch: { (def: Output): ZodCatch<this>; ( def: (ctx: { error: ZodError<any>; input: Input }) => Output ): ZodCatch<this>;};
method default
default: { (def: util.noUndefined<Input>): ZodDefault<this>; (def: () => util.noUndefined<Input>): ZodDefault<this>;};
method describe
describe: (description: string) => this;
method isNullable
isNullable: () => boolean;
method isOptional
isOptional: () => boolean;
method nullable
nullable: () => ZodNullable<this>;
method nullish
nullish: () => ZodOptional<ZodNullable<this>>;
method optional
optional: () => ZodOptional<this>;
method or
or: <T extends ZodTypeAny>(option: T) => ZodUnion<[this, T]>;
method parse
parse: (data: unknown, params?: Partial<ParseParams>) => Output;
method parseAsync
parseAsync: (data: unknown, params?: Partial<ParseParams>) => Promise<Output>;
method pipe
pipe: <T extends ZodTypeAny>(target: T) => ZodPipeline<this, T>;
method promise
promise: () => ZodPromise<this>;
method readonly
readonly: () => ZodReadonly<this>;
method refine
refine: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => CustomErrorParams) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => unknown, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => Partial<util.Omit<ZodCustomIssue, 'code'>>) ): ZodEffects<this, Output, Input>;};
method refinement
refinement: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => boolean, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, Output, Input>;};
method safeParse
safeParse: ( data: unknown, params?: Partial<ParseParams>) => SafeParseReturnType<Input, Output>;
method safeParseAsync
safeParseAsync: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
method superRefine
superRefine: { <RefinedOutput extends Output>( refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput ): ZodEffects<this, RefinedOutput, Input>; (refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects< this, Output, Input >; (refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects< this, Output, Input >;};
method transform
transform: <NewOut>( transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>) => ZodEffects<this, NewOut>;
class ZodAny
class ZodAny extends ZodType<any, ZodAnyDef, any> {}
property create
static create: (params?: RawCreateParams) => ZodAny;
class ZodArray
class ZodArray< T extends ZodTypeAny, Cardinality extends ArrayCardinality = 'many'> extends ZodType< arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends 'atleastone' ? [T['_input'], ...T['_input'][]] : T['_input'][]> {}
property create
static create: <T_1 extends ZodTypeAny>( schema: T_1, params?: RawCreateParams) => ZodArray<T_1, 'many'>;
property element
readonly element: ZodType<any, any, any>;
method length
length: (len: number, message?: errorUtil.ErrMessage) => this;
method max
max: (maxLength: number, message?: errorUtil.ErrMessage) => this;
method min
min: (minLength: number, message?: errorUtil.ErrMessage) => this;
method nonempty
nonempty: (message?: errorUtil.ErrMessage) => ZodArray<T, 'atleastone'>;
class ZodBigInt
class ZodBigInt extends ZodType<bigint, ZodBigIntDef, bigint> {}
property create
static create: (params?: RawCreateParams & { coerce?: boolean }) => ZodBigInt;
property max
max: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
property maxValue
readonly maxValue: BigInt;
property min
min: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
property minValue
readonly minValue: BigInt;
method gt
gt: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method gte
gte: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method lt
lt: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method lte
lte: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method multipleOf
multipleOf: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
method negative
negative: (message?: errorUtil.ErrMessage) => ZodBigInt;
method nonnegative
nonnegative: (message?: errorUtil.ErrMessage) => ZodBigInt;
method nonpositive
nonpositive: (message?: errorUtil.ErrMessage) => ZodBigInt;
method positive
positive: (message?: errorUtil.ErrMessage) => ZodBigInt;
method setLimit
protected setLimit: ( kind: 'min' | 'max', value: bigint, inclusive: boolean, message?: string) => ZodBigInt;
class ZodBoolean
class ZodBoolean extends ZodType<boolean, ZodBooleanDef, boolean> {}
property create
static create: (params?: RawCreateParams & { coerce?: boolean }) => ZodBoolean;
class ZodBranded
class ZodBranded< T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T['_output'] & BRAND<B>, ZodBrandedDef<T>, T['_input']> {}
method unwrap
unwrap: () => T;
class ZodCatch
class ZodCatch<T extends ZodTypeAny> extends ZodType< T['_output'], ZodCatchDef<T>, unknown> {}
property create
static create: <T_1 extends ZodTypeAny>( type: T_1, params: { errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; message?: string | undefined; description?: string | undefined; } & { catch: T_1['_output'] | (() => T_1['_output']) }) => ZodCatch<T_1>;
method removeCatch
removeCatch: () => T;
class ZodDate
class ZodDate extends ZodType<Date, ZodDateDef, Date> {}
property create
static create: (params?: RawCreateParams & { coerce?: boolean }) => ZodDate;
property maxDate
readonly maxDate: Date;
property minDate
readonly minDate: Date;
method max
max: (maxDate: Date, message?: errorUtil.ErrMessage) => ZodDate;
method min
min: (minDate: Date, message?: errorUtil.ErrMessage) => ZodDate;
class ZodDefault
class ZodDefault<T extends ZodTypeAny> extends ZodType< util.noUndefined<T['_output']>, ZodDefaultDef<T>, T['_input'] | undefined> {}
property create
static create: <T_1 extends ZodTypeAny>( type: T_1, params: { errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; message?: string | undefined; description?: string | undefined; } & { default: T_1['_input'] | (() => util.noUndefined<T_1['_input']>) }) => ZodDefault<T_1>;
method removeDefault
removeDefault: () => T;
class ZodDiscriminatedUnion
class ZodDiscriminatedUnion< Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<Discriminator>[]> extends ZodType< output<Options[number]>, ZodDiscriminatedUnionDef<Discriminator, Options>, input<Options[number]>> {}
property discriminator
readonly discriminator: string;
property options
readonly options: readonly ZodDiscriminatedUnionOption<Discriminator>[];
property optionsMap
readonly optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
method create
static create: < Discriminator extends string, Types extends readonly [ ZodDiscriminatedUnionOption<Discriminator>, ...ZodDiscriminatedUnionOption<Discriminator>[] ]>( discriminator: Discriminator, options: Types, params?: RawCreateParams) => 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.
Parameter discriminator
the name of the discriminator property
Parameter types
an array of object schemas
Parameter params
class ZodEffects
class ZodEffects< T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {}
property create
static create: <I extends ZodTypeAny>( schema: I, effect: Effect<I['_output']>, params?: RawCreateParams) => ZodEffects<I, I['_output'], input<I>>;
property createWithPreprocess
static createWithPreprocess: <I extends ZodTypeAny>( preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I['_output'], unknown>;
method innerType
innerType: () => T;
method sourceType
sourceType: () => T;
class ZodEnum
class ZodEnum<T extends [string, ...string[]]> extends ZodType< T[number], ZodEnumDef<T>, T[number]> {}
property create
static create: { <U extends string, T extends readonly [U, ...U[]]>( values: T, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodEnum<Writeable<T>>; <U extends string, T extends [U, ...U[]]>( values: T, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodEnum<T>;};
property enum
readonly enum: Values<T>;
property Enum
readonly Enum: Values<T>;
property options
readonly options: [string, ...string[]];
property Values
readonly Values: Values<T>;
method exclude
exclude: <ToExclude extends readonly [T[number], ...T[number][]]>( values: ToExclude, newDef?: RawCreateParams) => ZodEnum< typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
method extract
extract: <ToExtract extends readonly [T[number], ...T[number][]]>( values: ToExtract, newDef?: RawCreateParams) => ZodEnum<Writeable<ToExtract>>;
class ZodError
class ZodError<T = any> extends Error {}
constructor
constructor(issues: ZodIssue[]);
property addIssue
addIssue: (sub: ZodIssue) => void;
property addIssues
addIssues: (subs?: ZodIssue[]) => void;
property create
static create: (issues: ZodIssue[]) => ZodError<any>;
property errors
readonly errors: ZodIssue[];
property formErrors
readonly formErrors: typeToFlattenedError<T, string>;
property isEmpty
readonly isEmpty: boolean;
property issues
issues: ZodIssue[];
property message
readonly message: string;
method assert
static assert: (value: unknown) => asserts value is ZodError<any>;
method flatten
flatten: { (): typeToFlattenedError<T>; <U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;};
method format
format: { (): ZodFormattedError<T>; <U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;};
method toString
toString: () => string;
class ZodFunction
class ZodFunction< Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType< OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {}
property validate
validate: <F extends InnerTypeOfFunction<Args, Returns>>( func: F) => ReturnType<F> extends Returns['_output'] ? (...args: Args['_input']) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
method args
args: <Items extends [] | [ZodTypeAny, ...ZodTypeAny[]]>( ...items: Items) => ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
method create
static create: { (): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>; <T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction< T, ZodUnknown >; <T extends AnyZodTuple, U extends ZodTypeAny>( args: T, returns: U ): ZodFunction<T, U>; < T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown >( args: T, returns: U, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodFunction<T, U>;};
method implement
implement: <F extends InnerTypeOfFunction<Args, Returns>>( func: F) => ReturnType<F> extends Returns['_output'] ? (...args: Args['_input']) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
method parameters
parameters: () => Args;
method returns
returns: <NewReturnType extends ZodType<any, any, any>>( returnType: NewReturnType) => ZodFunction<Args, NewReturnType>;
method returnType
returnType: () => Returns;
method strictImplement
strictImplement: ( func: InnerTypeOfFunction<Args, Returns>) => InnerTypeOfFunction<Args, Returns>;
class ZodIntersection
class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType< T['_output'] & U['_output'], ZodIntersectionDef<T, U>, T['_input'] & U['_input']> {}
property create
static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>( left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
class ZodLazy
class ZodLazy<T extends ZodTypeAny> extends ZodType< output<T>, ZodLazyDef<T>, input<T>> {}
class ZodLiteral
class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {}
class ZodMap
class ZodMap< Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodType< Map<Key['_output'], Value['_output']>, ZodMapDef<Key, Value>, Map<Key['_input'], Value['_input']>> {}
property create
static create: < Key_1 extends ZodTypeAny = ZodTypeAny, Value_1 extends ZodTypeAny = ZodTypeAny>( keyType: Key_1, valueType: Value_1, params?: RawCreateParams) => ZodMap<Key_1, Value_1>;
property keySchema
readonly keySchema: ZodType<any, any, any>;
property valueSchema
readonly valueSchema: ZodType<any, any, any>;
class ZodNaN
class ZodNaN extends ZodType<number, ZodNaNDef, number> {}
property create
static create: (params?: RawCreateParams) => ZodNaN;
class ZodNativeEnum
class ZodNativeEnum<T extends EnumLike> extends ZodType< T[keyof T], ZodNativeEnumDef<T>, T[keyof T]> {}
class ZodNever
class ZodNever extends ZodType<never, ZodNeverDef, never> {}
property create
static create: (params?: RawCreateParams) => ZodNever;
class ZodNull
class ZodNull extends ZodType<null, ZodNullDef, null> {}
property create
static create: (params?: RawCreateParams) => ZodNull;
class ZodNullable
class ZodNullable<T extends ZodTypeAny> extends ZodType< T['_output'] | null, ZodNullableDef<T>, T['_input'] | null> {}
class ZodNumber
class ZodNumber extends ZodType<number, ZodNumberDef, number> {}
property create
static create: (params?: RawCreateParams & { coerce?: boolean }) => ZodNumber;
property isFinite
readonly isFinite: boolean;
property isInt
readonly isInt: boolean;
property max
max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
property maxValue
readonly maxValue: number;
property min
min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
property minValue
readonly minValue: number;
property step
step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method finite
finite: (message?: errorUtil.ErrMessage) => ZodNumber;
method gt
gt: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method gte
gte: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method int
int: (message?: errorUtil.ErrMessage) => ZodNumber;
method lt
lt: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method lte
lte: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method multipleOf
multipleOf: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
method negative
negative: (message?: errorUtil.ErrMessage) => ZodNumber;
method nonnegative
nonnegative: (message?: errorUtil.ErrMessage) => ZodNumber;
method nonpositive
nonpositive: (message?: errorUtil.ErrMessage) => ZodNumber;
method positive
positive: (message?: errorUtil.ErrMessage) => ZodNumber;
method safe
safe: (message?: errorUtil.ErrMessage) => ZodNumber;
method setLimit
protected setLimit: ( kind: 'min' | 'max', value: number, inclusive: boolean, message?: string) => ZodNumber;
class ZodObject
class ZodObject< T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {}
property augment
augment: <Augmentation extends ZodRawShape>( augmentation: Augmentation) => ZodObject< objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall, objectOutputType< objectUtil.extendShape<T, Augmentation>, Catchall, UnknownKeys >, objectInputType< objectUtil.extendShape<T, Augmentation>, Catchall, UnknownKeys >>;
Deprecated
Use
.extend
instead
property create
static create: <T_1 extends ZodRawShape>( shape: T_1, params?: RawCreateParams) => ZodObject< T_1, 'strip', ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks< baseObjectOutputType<T_1>, any >[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1] } : never>;
property lazycreate
static lazycreate: <T_1 extends ZodRawShape>( shape: () => T_1, params?: RawCreateParams) => ZodObject< T_1, 'strip', ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks< baseObjectOutputType<T_1>, any >[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1] } : never>;
property nonstrict
nonstrict: () => ZodObject<T, 'passthrough', Catchall>;
Deprecated
In most cases, this is no longer needed - unknown properties are now silently stripped. If you want to pass through unknown properties, use
.passthrough()
instead.
property shape
readonly shape: ZodRawShape;
property strictCreate
static strictCreate: <T_1 extends ZodRawShape>( shape: T_1, params?: RawCreateParams) => ZodObject< T_1, 'strict', ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks< baseObjectOutputType<T_1>, any >[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1] } : never>;
method catchall
catchall: <Index extends ZodTypeAny>( index: Index) => ZodObject<T, UnknownKeys, Index>;
method deepPartial
deepPartial: () => partialUtil.DeepPartial<this>;
Deprecated
method extend
extend: <Augmentation extends ZodRawShape>( augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
method keyof
keyof: () => ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
method merge
merge: <Incoming extends AnyZodObject, Augmentation extends Incoming['shape']>( merging: Incoming) => ZodObject< objectUtil.extendShape<T, Augmentation>, Incoming['_def']['unknownKeys'], Incoming['_def']['catchall']>;
Prior to zod@1.0.12 there was a bug in the inferred type of merged objects. Please upgrade if you are experiencing issues.
method omit
omit: <Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>( mask: Mask) => ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
method partial
partial: { (): ZodObject< { [k in keyof T]: ZodOptional<T[k]> }, UnknownKeys, Catchall, objectOutputType< { [k in keyof T]: ZodOptional<T[k]> }, Catchall, UnknownKeys >, objectInputType< { [k in keyof T]: ZodOptional<T[k]> }, Catchall, UnknownKeys > >; <Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>( mask: Mask ): ZodObject< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }[k] : never; }, UnknownKeys, Catchall, objectOutputType< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }[k] : never; }, Catchall, UnknownKeys >, objectInputType< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]; }[k] : never; }, Catchall, UnknownKeys > >;};
method passthrough
passthrough: () => ZodObject<T, 'passthrough', Catchall>;
method pick
pick: <Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>( mask: Mask) => ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
method required
required: { (): ZodObject< { [k in keyof T]: deoptional<T[k]> }, UnknownKeys, Catchall, objectOutputType< { [k in keyof T]: deoptional<T[k]> }, Catchall, UnknownKeys >, objectInputType< { [k in keyof T]: deoptional<T[k]> }, Catchall, UnknownKeys > >; <Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>( mask: Mask ): ZodObject< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }[k] : never; }, UnknownKeys, Catchall, objectOutputType< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }[k] : never; }, Catchall, UnknownKeys >, objectInputType< { [k in objectUtil.noNeverKeys<{ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }>]: k extends keyof T ? { [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]; }[k] : never; }, Catchall, UnknownKeys > >;};
method setKey
setKey: <Key extends string, Schema extends ZodTypeAny>( key: Key, schema: Schema) => ZodObject< T & { [k in Key]: Schema }, UnknownKeys, Catchall, objectOutputType<T & { [k in Key]: Schema }, Catchall, UnknownKeys>, objectInputType<T & { [k in Key]: Schema }, Catchall, UnknownKeys>>;
method strict
strict: (message?: errorUtil.ErrMessage) => ZodObject<T, 'strict', Catchall>;
method strip
strip: () => ZodObject<T, 'strip', Catchall>;
class ZodOptional
class ZodOptional<T extends ZodTypeAny> extends ZodType< T['_output'] | undefined, ZodOptionalDef<T>, T['_input'] | undefined> {}
class ZodPipeline
class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType< B['_output'], ZodPipelineDef<A, B>, A['_input']> {}
method create
static create: <A extends ZodTypeAny, B extends ZodTypeAny>( a: A, b: B) => ZodPipeline<A, B>;
class ZodPromise
class ZodPromise<T extends ZodTypeAny> extends ZodType< Promise<T['_output']>, ZodPromiseDef<T>, Promise<T['_input']>> {}
class ZodReadonly
class ZodReadonly<T extends ZodTypeAny> extends ZodType< MakeReadonly<T['_output']>, ZodReadonlyDef<T>, MakeReadonly<T['_input']>> {}
class ZodRecord
class ZodRecord< Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodType< RecordType<Key['_output'], Value['_output']>, ZodRecordDef<Key, Value>, RecordType<Key['_input'], Value['_input']>> {}
property element
readonly element: ZodType<any, any, any>;
property keySchema
readonly keySchema: ZodType<string | number | symbol, any, any>;
property valueSchema
readonly valueSchema: ZodType<any, any, any>;
method create
static create: { <Value extends ZodTypeAny>( valueType: Value, params?: RawCreateParams ): ZodRecord<ZodString, Value>; <Keys extends KeySchema, Value extends ZodTypeAny>( keySchema: Keys, valueType: Value, params?: { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } ): ZodRecord<Keys, Value>;};
class ZodSchema
abstract class ZodType< Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {}
constructor
constructor(def: ZodTypeDef);
property "~standard"
'~standard': StandardSchemaV1.Props<Input, Output>;
property description
readonly description: string;
property spa
spa: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
Alias of safeParseAsync
method "~validate"
'~validate': ( data: unknown) => StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
method and
and: <T extends ZodTypeAny>(incoming: T) => ZodIntersection<this, T>;
method array
array: () => ZodArray<this>;
method brand
brand: <B extends string | number | symbol>(brand?: B) => ZodBranded<this, B>;
method catch
catch: { (def: Output): ZodCatch<this>; ( def: (ctx: { error: ZodError<any>; input: Input }) => Output ): ZodCatch<this>;};
method default
default: { (def: util.noUndefined<Input>): ZodDefault<this>; (def: () => util.noUndefined<Input>): ZodDefault<this>;};
method describe
describe: (description: string) => this;
method isNullable
isNullable: () => boolean;
method isOptional
isOptional: () => boolean;
method nullable
nullable: () => ZodNullable<this>;
method nullish
nullish: () => ZodOptional<ZodNullable<this>>;
method optional
optional: () => ZodOptional<this>;
method or
or: <T extends ZodTypeAny>(option: T) => ZodUnion<[this, T]>;
method parse
parse: (data: unknown, params?: Partial<ParseParams>) => Output;
method parseAsync
parseAsync: (data: unknown, params?: Partial<ParseParams>) => Promise<Output>;
method pipe
pipe: <T extends ZodTypeAny>(target: T) => ZodPipeline<this, T>;
method promise
promise: () => ZodPromise<this>;
method readonly
readonly: () => ZodReadonly<this>;
method refine
refine: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => CustomErrorParams) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => unknown, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => Partial<util.Omit<ZodCustomIssue, 'code'>>) ): ZodEffects<this, Output, Input>;};
method refinement
refinement: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => boolean, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, Output, Input>;};
method safeParse
safeParse: ( data: unknown, params?: Partial<ParseParams>) => SafeParseReturnType<Input, Output>;
method safeParseAsync
safeParseAsync: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
method superRefine
superRefine: { <RefinedOutput extends Output>( refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput ): ZodEffects<this, RefinedOutput, Input>; (refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects< this, Output, Input >; (refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects< this, Output, Input >;};
method transform
transform: <NewOut>( transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>) => ZodEffects<this, NewOut>;
class ZodSet
class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType< Set<Value['_output']>, ZodSetDef<Value>, Set<Value['_input']>> {}
property create
static create: <Value_1 extends ZodTypeAny = ZodTypeAny>( valueType: Value_1, params?: RawCreateParams) => ZodSet<Value_1>;
method max
max: (maxSize: number, message?: errorUtil.ErrMessage) => this;
method min
min: (minSize: number, message?: errorUtil.ErrMessage) => this;
method nonempty
nonempty: (message?: errorUtil.ErrMessage) => ZodSet<Value>;
method size
size: (size: number, message?: errorUtil.ErrMessage) => this;
class ZodString
class ZodString extends ZodType<string, ZodStringDef, string> {}
property create
static create: (params?: RawCreateParams & { coerce?: true }) => ZodString;
property isBase64
readonly isBase64: boolean;
property isBase64url
readonly isBase64url: boolean;
property isCIDR
readonly isCIDR: boolean;
property isCUID
readonly isCUID: boolean;
property isCUID2
readonly isCUID2: boolean;
property isDate
readonly isDate: boolean;
property isDatetime
readonly isDatetime: boolean;
property isDuration
readonly isDuration: boolean;
property isEmail
readonly isEmail: boolean;
property isEmoji
readonly isEmoji: boolean;
property isIP
readonly isIP: boolean;
property isNANOID
readonly isNANOID: boolean;
property isTime
readonly isTime: boolean;
property isULID
readonly isULID: boolean;
property isURL
readonly isURL: boolean;
property isUUID
readonly isUUID: boolean;
property maxLength
readonly maxLength: number;
property minLength
readonly minLength: number;
method base64
base64: (message?: errorUtil.ErrMessage) => ZodString;
method base64url
base64url: (message?: errorUtil.ErrMessage) => ZodString;
method cidr
cidr: ( options?: string | { version?: IpVersion; message?: string }) => ZodString;
method cuid
cuid: (message?: errorUtil.ErrMessage) => ZodString;
method cuid2
cuid2: (message?: errorUtil.ErrMessage) => ZodString;
method date
date: (message?: string) => ZodString;
method datetime
datetime: ( options?: | string | { message?: string | undefined; precision?: number | null; offset?: boolean; local?: boolean; }) => ZodString;
method duration
duration: (message?: errorUtil.ErrMessage) => ZodString;
method email
email: (message?: errorUtil.ErrMessage) => ZodString;
method emoji
emoji: (message?: errorUtil.ErrMessage) => ZodString;
method endsWith
endsWith: (value: string, message?: errorUtil.ErrMessage) => ZodString;
method includes
includes: ( value: string, options?: { message?: string; position?: number }) => ZodString;
method ip
ip: (options?: string | { version?: IpVersion; message?: string }) => ZodString;
method jwt
jwt: (options?: { alg?: string; message?: string }) => ZodString;
method length
length: (len: number, message?: errorUtil.ErrMessage) => ZodString;
method max
max: (maxLength: number, message?: errorUtil.ErrMessage) => ZodString;
method min
min: (minLength: number, message?: errorUtil.ErrMessage) => ZodString;
method nanoid
nanoid: (message?: errorUtil.ErrMessage) => ZodString;
method nonempty
nonempty: (message?: errorUtil.ErrMessage) => ZodString;
Equivalent to
.min(1)
method regex
regex: (regex: RegExp, message?: errorUtil.ErrMessage) => ZodString;
method startsWith
startsWith: (value: string, message?: errorUtil.ErrMessage) => ZodString;
method time
time: ( options?: | string | { message?: string | undefined; precision?: number | null }) => ZodString;
method toLowerCase
toLowerCase: () => ZodString;
method toUpperCase
toUpperCase: () => ZodString;
method trim
trim: () => ZodString;
method ulid
ulid: (message?: errorUtil.ErrMessage) => ZodString;
method url
url: (message?: errorUtil.ErrMessage) => ZodString;
method uuid
uuid: (message?: errorUtil.ErrMessage) => ZodString;
class ZodSymbol
class ZodSymbol extends ZodType<symbol, ZodSymbolDef, symbol> {}
property create
static create: (params?: RawCreateParams) => ZodSymbol;
class ZodTransformer
class ZodEffects< T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {}
property create
static create: <I extends ZodTypeAny>( schema: I, effect: Effect<I['_output']>, params?: RawCreateParams) => ZodEffects<I, I['_output'], input<I>>;
property createWithPreprocess
static createWithPreprocess: <I extends ZodTypeAny>( preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I['_output'], unknown>;
method innerType
innerType: () => T;
method sourceType
sourceType: () => T;
class ZodTuple
class ZodTuple< T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> extends ZodType< OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {}
class ZodType
abstract class ZodType< Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {}
constructor
constructor(def: ZodTypeDef);
property "~standard"
'~standard': StandardSchemaV1.Props<Input, Output>;
property description
readonly description: string;
property spa
spa: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
Alias of safeParseAsync
method "~validate"
'~validate': ( data: unknown) => StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
method and
and: <T extends ZodTypeAny>(incoming: T) => ZodIntersection<this, T>;
method array
array: () => ZodArray<this>;
method brand
brand: <B extends string | number | symbol>(brand?: B) => ZodBranded<this, B>;
method catch
catch: { (def: Output): ZodCatch<this>; ( def: (ctx: { error: ZodError<any>; input: Input }) => Output ): ZodCatch<this>;};
method default
default: { (def: util.noUndefined<Input>): ZodDefault<this>; (def: () => util.noUndefined<Input>): ZodDefault<this>;};
method describe
describe: (description: string) => this;
method isNullable
isNullable: () => boolean;
method isOptional
isOptional: () => boolean;
method nullable
nullable: () => ZodNullable<this>;
method nullish
nullish: () => ZodOptional<ZodNullable<this>>;
method optional
optional: () => ZodOptional<this>;
method or
or: <T extends ZodTypeAny>(option: T) => ZodUnion<[this, T]>;
method parse
parse: (data: unknown, params?: Partial<ParseParams>) => Output;
method parseAsync
parseAsync: (data: unknown, params?: Partial<ParseParams>) => Promise<Output>;
method pipe
pipe: <T extends ZodTypeAny>(target: T) => ZodPipeline<this, T>;
method promise
promise: () => ZodPromise<this>;
method readonly
readonly: () => ZodReadonly<this>;
method refine
refine: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => CustomErrorParams) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => unknown, message?: | string | Partial<util.Omit<ZodCustomIssue, 'code'>> | ((arg: Output) => Partial<util.Omit<ZodCustomIssue, 'code'>>) ): ZodEffects<this, Output, Input>;};
method refinement
refinement: { <RefinedOutput extends Output>( check: (arg: Output) => arg is RefinedOutput, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, RefinedOutput, Input>; ( check: (arg: Output) => boolean, refinementData: | IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData) ): ZodEffects<this, Output, Input>;};
method safeParse
safeParse: ( data: unknown, params?: Partial<ParseParams>) => SafeParseReturnType<Input, Output>;
method safeParseAsync
safeParseAsync: ( data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
method superRefine
superRefine: { <RefinedOutput extends Output>( refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput ): ZodEffects<this, RefinedOutput, Input>; (refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects< this, Output, Input >; (refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects< this, Output, Input >;};
method transform
transform: <NewOut>( transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>) => ZodEffects<this, NewOut>;
class ZodUndefined
class ZodUndefined extends ZodType<undefined, ZodUndefinedDef, undefined> {}
class ZodUnion
class ZodUnion<T extends ZodUnionOptions> extends ZodType< T[number]['_output'], ZodUnionDef<T>, T[number]['_input']> {}
class ZodUnknown
class ZodUnknown extends ZodType<unknown, ZodUnknownDef, unknown> {}
property create
static create: (params?: RawCreateParams) => ZodUnknown;
class ZodVoid
class ZodVoid extends ZodType<void, ZodVoidDef, void> {}
property create
static create: (params?: RawCreateParams) => ZodVoid;
interface ParseContext
interface ParseContext {}
property common
readonly common: { readonly issues: ZodIssue[]; readonly contextualErrorMap?: ZodErrorMap; readonly async: boolean;};
property data
readonly data: any;
property parent
readonly parent: ParseContext | null;
property parsedType
readonly parsedType: ZodParsedType;
property path
readonly path: ParsePath;
property schemaErrorMap
readonly schemaErrorMap?: ZodErrorMap;
interface ParseResult
interface ParseResult {}
interface RefinementCtx
interface RefinementCtx {}
interface ZodAnyDef
interface ZodAnyDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodAny;
interface ZodArrayDef
interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
property exactLength
exactLength: { value: number; message?: string;} | null;
property maxLength
maxLength: { value: number; message?: string;} | null;
property minLength
minLength: { value: number; message?: string;} | null;
property type
type: T;
property typeName
typeName: ZodFirstPartyTypeKind.ZodArray;
interface ZodBigIntDef
interface ZodBigIntDef extends ZodTypeDef {}
interface ZodBooleanDef
interface ZodBooleanDef extends ZodTypeDef {}
interface ZodBrandedDef
interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {}
interface ZodCatchDef
interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
property catchValue
catchValue: (ctx: { error: ZodError; input: unknown }) => T['_input'];
property innerType
innerType: T;
property typeName
typeName: ZodFirstPartyTypeKind.ZodCatch;
interface ZodCustomIssue
interface ZodCustomIssue extends ZodIssueBase {}
interface ZodDateDef
interface ZodDateDef extends ZodTypeDef {}
interface ZodDefaultDef
interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
property defaultValue
defaultValue: () => util.noUndefined<T['_input']>;
property innerType
innerType: T;
property typeName
typeName: ZodFirstPartyTypeKind.ZodDefault;
interface ZodDiscriminatedUnionDef
interface ZodDiscriminatedUnionDef< Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<string>[] = ZodDiscriminatedUnionOption<string>[]> extends ZodTypeDef {}
property discriminator
discriminator: Discriminator;
property options
options: Options;
property optionsMap
optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
property typeName
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion;
interface ZodEffectsDef
interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodEnumDef
interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {}
interface ZodFunctionDef
interface ZodFunctionDef< Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodIntersectionDef
interface ZodIntersectionDef< T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodInvalidArgumentsIssue
interface ZodInvalidArgumentsIssue extends ZodIssueBase {}
property argumentsError
argumentsError: ZodError;
property code
code: typeof ZodIssueCode.invalid_arguments;
interface ZodInvalidDateIssue
interface ZodInvalidDateIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_date;
interface ZodInvalidEnumValueIssue
interface ZodInvalidEnumValueIssue extends ZodIssueBase {}
interface ZodInvalidIntersectionTypesIssue
interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_intersection_types;
interface ZodInvalidLiteralIssue
interface ZodInvalidLiteralIssue extends ZodIssueBase {}
interface ZodInvalidReturnTypeIssue
interface ZodInvalidReturnTypeIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_return_type;
property returnTypeError
returnTypeError: ZodError;
interface ZodInvalidStringIssue
interface ZodInvalidStringIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_string;
property validation
validation: StringValidation;
interface ZodInvalidTypeIssue
interface ZodInvalidTypeIssue extends ZodIssueBase {}
interface ZodInvalidUnionDiscriminatorIssue
interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {}
interface ZodInvalidUnionIssue
interface ZodInvalidUnionIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.invalid_union;
property unionErrors
unionErrors: ZodError[];
interface ZodLazyDef
interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodLiteralDef
interface ZodLiteralDef<T = any> extends ZodTypeDef {}
interface ZodMapDef
interface ZodMapDef< Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodNaNDef
interface ZodNaNDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodNaN;
interface ZodNativeEnumDef
interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {}
interface ZodNeverDef
interface ZodNeverDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodNever;
interface ZodNotFiniteIssue
interface ZodNotFiniteIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.not_finite;
interface ZodNotMultipleOfIssue
interface ZodNotMultipleOfIssue extends ZodIssueBase {}
property code
code: typeof ZodIssueCode.not_multiple_of;
property multipleOf
multipleOf: number | bigint;
interface ZodNullableDef
interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodNullDef
interface ZodNullDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodNull;
interface ZodNumberDef
interface ZodNumberDef extends ZodTypeDef {}
interface ZodObjectDef
interface ZodObjectDef< T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
property catchall
catchall: Catchall;
property shape
shape: () => T;
property typeName
typeName: ZodFirstPartyTypeKind.ZodObject;
property unknownKeys
unknownKeys: UnknownKeys;
interface ZodOptionalDef
interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodPipelineDef
interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {}
interface ZodPromiseDef
interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodReadonlyDef
interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodRecordDef
interface ZodRecordDef< Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodSetDef
interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {}
interface ZodStringDef
interface ZodStringDef extends ZodTypeDef {}
interface ZodSymbolDef
interface ZodSymbolDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodSymbol;
interface ZodTooBigIssue
interface ZodTooBigIssue extends ZodIssueBase {}
interface ZodTooSmallIssue
interface ZodTooSmallIssue extends ZodIssueBase {}
interface ZodTupleDef
interface ZodTupleDef< T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {}
interface ZodTypeDef
interface ZodTypeDef {}
property description
description?: string;
property errorMap
errorMap?: ZodErrorMap;
interface ZodUndefinedDef
interface ZodUndefinedDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodUndefined;
interface ZodUnionDef
interface ZodUnionDef< T extends ZodUnionOptions = Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>> extends ZodTypeDef {}
interface ZodUnknownDef
interface ZodUnknownDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodUnknown;
interface ZodUnrecognizedKeysIssue
interface ZodUnrecognizedKeysIssue extends ZodIssueBase {}
interface ZodVoidDef
interface ZodVoidDef extends ZodTypeDef {}
property typeName
typeName: ZodFirstPartyTypeKind.ZodVoid;
enum ZodFirstPartyTypeKind
enum ZodFirstPartyTypeKind { ZodString = 'ZodString', ZodNumber = 'ZodNumber', ZodNaN = 'ZodNaN', ZodBigInt = 'ZodBigInt', ZodBoolean = 'ZodBoolean', ZodDate = 'ZodDate', ZodSymbol = 'ZodSymbol', ZodUndefined = 'ZodUndefined', ZodNull = 'ZodNull', ZodAny = 'ZodAny', ZodUnknown = 'ZodUnknown', ZodNever = 'ZodNever', ZodVoid = 'ZodVoid', ZodArray = 'ZodArray', ZodObject = 'ZodObject', ZodUnion = 'ZodUnion', ZodDiscriminatedUnion = 'ZodDiscriminatedUnion', ZodIntersection = 'ZodIntersection', ZodTuple = 'ZodTuple', ZodRecord = 'ZodRecord', ZodMap = 'ZodMap', ZodSet = 'ZodSet', ZodFunction = 'ZodFunction', ZodLazy = 'ZodLazy', ZodLiteral = 'ZodLiteral', ZodEnum = 'ZodEnum', ZodEffects = 'ZodEffects', ZodNativeEnum = 'ZodNativeEnum', ZodOptional = 'ZodOptional', ZodNullable = 'ZodNullable', ZodDefault = 'ZodDefault', ZodCatch = 'ZodCatch', ZodPromise = 'ZodPromise', ZodBranded = 'ZodBranded', ZodPipeline = 'ZodPipeline', ZodReadonly = 'ZodReadonly',}
member ZodAny
ZodAny = 'ZodAny'
member ZodArray
ZodArray = 'ZodArray'
member ZodBigInt
ZodBigInt = 'ZodBigInt'
member ZodBoolean
ZodBoolean = 'ZodBoolean'
member ZodBranded
ZodBranded = 'ZodBranded'
member ZodCatch
ZodCatch = 'ZodCatch'
member ZodDate
ZodDate = 'ZodDate'
member ZodDefault
ZodDefault = 'ZodDefault'
member ZodDiscriminatedUnion
ZodDiscriminatedUnion = 'ZodDiscriminatedUnion'
member ZodEffects
ZodEffects = 'ZodEffects'
member ZodEnum
ZodEnum = 'ZodEnum'
member ZodFunction
ZodFunction = 'ZodFunction'
member ZodIntersection
ZodIntersection = 'ZodIntersection'
member ZodLazy
ZodLazy = 'ZodLazy'
member ZodLiteral
ZodLiteral = 'ZodLiteral'
member ZodMap
ZodMap = 'ZodMap'
member ZodNaN
ZodNaN = 'ZodNaN'
member ZodNativeEnum
ZodNativeEnum = 'ZodNativeEnum'
member ZodNever
ZodNever = 'ZodNever'
member ZodNull
ZodNull = 'ZodNull'
member ZodNullable
ZodNullable = 'ZodNullable'
member ZodNumber
ZodNumber = 'ZodNumber'
member ZodObject
ZodObject = 'ZodObject'
member ZodOptional
ZodOptional = 'ZodOptional'
member ZodPipeline
ZodPipeline = 'ZodPipeline'
member ZodPromise
ZodPromise = 'ZodPromise'
member ZodReadonly
ZodReadonly = 'ZodReadonly'
member ZodRecord
ZodRecord = 'ZodRecord'
member ZodSet
ZodSet = 'ZodSet'
member ZodString
ZodString = 'ZodString'
member ZodSymbol
ZodSymbol = 'ZodSymbol'
member ZodTuple
ZodTuple = 'ZodTuple'
member ZodUndefined
ZodUndefined = 'ZodUndefined'
member ZodUnion
ZodUnion = 'ZodUnion'
member ZodUnknown
ZodUnknown = 'ZodUnknown'
member ZodVoid
ZodVoid = 'ZodVoid'
type AnyZodObject
type AnyZodObject = ZodObject<any, any, any>;
type AnyZodTuple
type AnyZodTuple = ZodTuple<[ZodTypeAny, ...ZodTypeAny[]] | [], ZodTypeAny | null>;
type ArrayCardinality
type ArrayCardinality = 'many' | 'atleastone';
type ArrayKeys
type ArrayKeys = keyof any[];
type arrayOutputType
type arrayOutputType< T extends ZodTypeAny, Cardinality extends ArrayCardinality = 'many'> = Cardinality extends 'atleastone' ? [T['_output'], ...T['_output'][]] : T['_output'][];
type AssertArray
type AssertArray<T> = T extends any[] ? T : never;
type AsyncParseReturnType
type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
type baseObjectInputType
type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{ [k in keyof Shape]: Shape[k]['_input'];}>;
type baseObjectOutputType
type baseObjectOutputType<Shape extends ZodRawShape> = { [k in keyof Shape]: Shape[k]['_output'];};
type BRAND
type BRAND<T extends string | number | symbol> = { [BRAND]: { [k in T]: true; };};
type CatchallInput
type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : { [k: string]: T['_input']; };
type CatchallOutput
type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : { [k: string]: T['_output']; };
type CustomErrorParams
type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, 'code'>>;
type DenormalizedError
type DenormalizedError = { [k: string]: DenormalizedError | string[];};
type deoptional
type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
type DIRTY
type DIRTY<T> = { status: 'dirty'; value: T;};
type Effect
type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
type EnumLike
type EnumLike = { [k: string]: string | number; [nu: number]: string;};
type EnumValues
type EnumValues<T extends string = string> = readonly [T, ...T[]];
type ErrorMapCtx
type ErrorMapCtx = { defaultError: string; data: any;};
type FilterEnum
type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
type Indices
type Indices<T> = Exclude<keyof T, ArrayKeys>;
type infer
type TypeOf<T extends ZodType<any, any, any>> = T['_output'];
type inferFlattenedErrors
type inferFlattenedErrors< T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
type inferFormattedError
type inferFormattedError< T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
type InnerTypeOfFunction
type InnerTypeOfFunction< Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args['_output'] extends Array<any> ? (...args: Args['_output']) => Returns['_input'] : never;
type input
type input<T extends ZodType<any, any, any>> = T['_input'];
type InputTypeOfTuple
type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]['_input'] : never;}>;
type InputTypeOfTupleWithRest
type InputTypeOfTupleWithRest< T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest['_input'][]] : InputTypeOfTuple<T>;
type INVALID
type INVALID = { status: 'aborted';};
type IpVersion
type IpVersion = 'v4' | 'v6';
type IssueData
type IssueData = stripPath<ZodIssueOptionalMessage> & { path?: (string | number)[]; fatal?: boolean;};
type KeySchema
type KeySchema = ZodType<string | number | symbol, any, any>;
type mergeTypes
type mergeTypes<A, B> = { [k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;};
type noUnrecognized
type noUnrecognized<Obj extends object, Shape extends object> = { [k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;};
type objectInputType
type objectInputType< Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
type objectOutputType
type objectOutputType< Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
type ObjectPair
type ObjectPair = { key: SyncParseReturnType<any>; value: SyncParseReturnType<any>;};
type OK
type OK<T> = { status: 'valid'; value: T;};
type OuterTypeOfFunction
type OuterTypeOfFunction< Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args['_input'] extends Array<any> ? (...args: Args['_input']) => Returns['_output'] : never;
type output
type output<T extends ZodType<any, any, any>> = T['_output'];
type OutputTypeOfTuple
type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]['_output'] : never;}>;
type OutputTypeOfTupleWithRest
type OutputTypeOfTupleWithRest< T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest['_output'][]] : OutputTypeOfTuple<T>;
type ParseInput
type ParseInput = { data: any; path: (string | number)[]; parent: ParseContext;};
type ParseParams
type ParseParams = { path: (string | number)[]; errorMap: ZodErrorMap; async: boolean;};
type ParsePath
type ParsePath = ParsePathComponent[];
type ParsePathComponent
type ParsePathComponent = string | number;
type ParseReturnType
type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
type PassthroughType
type PassthroughType<T extends UnknownKeysParam> = T extends 'passthrough' ? { [k: string]: unknown; } : unknown;
type PreprocessEffect
type PreprocessEffect<T> = { type: 'preprocess'; transform: (arg: T, ctx: RefinementCtx) => any;};
type Primitive
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
type ProcessedCreateParams
type ProcessedCreateParams = { errorMap?: ZodErrorMap; description?: string;};
type RawCreateParams
type RawCreateParams = | { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; message?: string; description?: string; } | undefined;
type RecordType
type RecordType<K extends string | number | symbol, 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 Refinement
type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
type RefinementEffect
type RefinementEffect<T> = { type: 'refinement'; refinement: (arg: T, ctx: RefinementCtx) => any;};
type SafeParseError
type SafeParseError<Input> = { success: false; error: ZodError<Input>; data?: never;};
type SafeParseReturnType
type SafeParseReturnType<Input, Output> = | SafeParseSuccess<Output> | SafeParseError<Input>;
type SafeParseSuccess
type SafeParseSuccess<Output> = { success: true; data: Output; error?: never;};
type Scalars
type Scalars = Primitive | Primitive[];
type SomeZodObject
type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
type StringValidation
type 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; };
type SuperRefinement
type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
type SyncParseReturnType
type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
type TransformEffect
type TransformEffect<T> = { type: 'transform'; transform: (arg: T, ctx: RefinementCtx) => any;};
type typecast
type typecast<A, T> = A extends T ? A : never;
type TypeOf
type TypeOf<T extends ZodType<any, any, any>> = T['_output'];
type typeToFlattenedError
type typeToFlattenedError<T, U = string> = { formErrors: U[]; fieldErrors: { [P in allKeys<T>]?: U[]; };};
type UnknownKeysParam
type UnknownKeysParam = 'passthrough' | 'strict' | 'strip';
type Values
type Values<T extends EnumValues> = { [k in T[number]]: k;};
type Writeable
type Writeable<T> = { -readonly [P in keyof T]: T[P];};
type ZodBigIntCheck
type ZodBigIntCheck = | { kind: 'min'; value: bigint; inclusive: boolean; message?: string; } | { kind: 'max'; value: bigint; inclusive: boolean; message?: string; } | { kind: 'multipleOf'; value: bigint; message?: string; };
type ZodDateCheck
type ZodDateCheck = | { kind: 'min'; value: number; message?: string; } | { kind: 'max'; value: number; message?: string; };
type ZodDiscriminatedUnionOption
type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject< { [key in Discriminator]: ZodTypeAny; } & ZodRawShape, UnknownKeysParam, ZodTypeAny>;
type ZodErrorMap
type ZodErrorMap = ( issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { message: string;};
type ZodFirstPartySchemaTypes
type 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;
type ZodFormattedError
type ZodFormattedError<T, U = string> = { _errors: U[];} & recursiveZodFormattedError<NonNullable<T>>;
type ZodIssue
type ZodIssue = ZodIssueOptionalMessage & { fatal?: boolean; message: string;};
type ZodIssueBase
type ZodIssueBase = { path: (string | number)[]; message?: string;};
type ZodIssueCode
type ZodIssueCode = keyof typeof ZodIssueCode;
type ZodIssueOptionalMessage
type ZodIssueOptionalMessage = | ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
type ZodNonEmptyArray
type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, 'atleastone'>;
type ZodNullableType
type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
type ZodNumberCheck
type ZodNumberCheck = | { kind: 'min'; value: number; inclusive: boolean; message?: string; } | { kind: 'max'; value: number; inclusive: boolean; message?: string; } | { kind: 'int'; message?: string; } | { kind: 'multipleOf'; value: number; message?: string; } | { kind: 'finite'; message?: string; };
type ZodOptionalType
type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
type ZodParsedType
type ZodParsedType = keyof typeof ZodParsedType;
type ZodRawShape
type ZodRawShape = { [k: string]: ZodTypeAny;};
type ZodStringCheck
type ZodStringCheck = | { kind: 'min'; value: number; message?: string; } | { kind: 'max'; value: number; message?: string; } | { kind: 'length'; value: number; message?: string; } | { 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'; value: string; position?: number; message?: string; } | { kind: 'cuid2'; message?: string; } | { kind: 'ulid'; message?: string; } | { kind: 'startsWith'; value: string; message?: string; } | { kind: 'endsWith'; value: string; message?: string; } | { kind: 'regex'; regex: RegExp; message?: string; } | { kind: 'trim'; message?: string; } | { kind: 'toLowerCase'; message?: string; } | { kind: 'toUpperCase'; message?: string; } | { kind: 'jwt'; alg?: string; message?: string; } | { kind: 'datetime'; offset: boolean; local: boolean; precision: number | null; message?: string; } | { kind: 'date'; message?: string; } | { kind: 'time'; precision: number | null; message?: string; } | { kind: 'duration'; message?: string; } | { kind: 'ip'; version?: IpVersion; message?: string; } | { kind: 'cidr'; version?: IpVersion; message?: string; } | { kind: 'base64'; message?: string; } | { kind: 'base64url'; message?: string; };
type ZodTupleItems
type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
type ZodTypeAny
type ZodTypeAny = ZodType<any, any, any>;
type ZodUnionOptions
type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
namespace z.objectUtil
namespace z.objectUtil {}
function mergeShapes
mergeShapes: <U, T>(first: U, second: T) => T & U;
type addQuestionMarks
type addQuestionMarks<T extends object, _O = any> = { [K in requiredKeys<T>]: T[K];} & { [K in optionalKeys<T>]?: T[K];} & { [k in keyof T]?: unknown;};
type extendShape
type extendShape<A extends object, B extends object> = keyof A & keyof B extends never ? A & B : { [K in keyof A as K extends keyof B ? never : K]: A[K]; } & { [K in keyof B]: B[K]; };
type flatten
type flatten<T> = identity<{ [k in keyof T]: T[k];}>;
type identity
type identity<T> = T;
type MergeShapes
type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : { [k in Exclude<keyof U, keyof V>]: U[k]; } & V;
type noNever
type noNever<T> = identity<{ [k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;}>;
type noNeverKeys
type noNeverKeys<T> = { [k in keyof T]: [T[k]] extends [never] ? never : k;}[keyof T];
namespace z.util
namespace z.util {}
variable isInteger
const isInteger: (number: unknown) => boolean;
variable objectKeys
const objectKeys: { (o: object): string[]; (o: {}): string[] };
function arrayToEnum
arrayToEnum: <T extends string, U extends [T, ...T[]]>( items: U) => { [k in U[number]]: k };
function assertEqual
assertEqual: <A, B>(val: AssertEqual<A, B>) => AssertEqual<A, B>;
function assertIs
assertIs: <T>(_arg: T) => void;
function assertNever
assertNever: (_x: never) => never;
function find
find: <T>(arr: T[], checker: (arg: T) => any) => T;
function getValidEnumValues
getValidEnumValues: (obj: any) => any[];
function joinValues
joinValues: <T extends any[]>(array: T, separator?: string) => string;
function jsonStringifyReplacer
jsonStringifyReplacer: (_: string, value: any) => any;
function objectValues
objectValues: (obj: any) => any[];
type Exactly
type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
type flatten
type flatten<T> = objectUtil.flatten<T>;
type identity
type identity<T> = objectUtil.identity<T>;
type isAny
type isAny<T> = 0 extends 1 & T ? true : false;
type MakePartial
type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
type noUndefined
type noUndefined<T> = T extends undefined ? never : T;
type Omit
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type OmitKeys
type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
Package Files (9)
Dependencies (0)
No dependencies.
Dev Dependencies (37)
- @babel/core
- @babel/preset-env
- @babel/preset-typescript
- @jest/globals
- @rollup/plugin-typescript
- @standard-schema/spec
- @swc/core
- @swc/jest
- @types/benchmark
- @types/jest
- @types/node
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- babel-jest
- benchmark
- dependency-cruiser
- eslint
- eslint-config-prettier
- eslint-plugin-ban
- eslint-plugin-import
- eslint-plugin-simple-import-sort
- eslint-plugin-unused-imports
- husky
- jest
- lint-staged
- netlify-cli
- nodemon
- prettier
- pretty-quick
- rollup
- ts-jest
- ts-morph
- ts-node
- tslib
- tsx
- typescript
- vitest
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/zod
.
- Markdown[](https://www.jsdocs.io/package/zod)
- HTML<a href="https://www.jsdocs.io/package/zod"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 16252 ms. - Missing or incorrect documentation? Open an issue for this package.