Class ZodType<Output, Def, Input>Abstract
Type Parameters
-
Output = any
-
-
Input = Output
Constructors
constructor
- new ZodType<Output, Def, Input>(def): ZodType<Output, Def, Input>
-
Type Parameters
-
Output = any
-
-
Input = Output
Returns ZodType<Output, Def, Input>
Properties
Readonly
_def
_def: Def
Readonly
_input
_input: Input
Readonly
_output
_output: Output
Readonly
_type
_type: Output
spa
Accessors
description
- get description(): undefined | string
-
Returns undefined | string
Methods
_getOrReturnCtx
- _getOrReturnCtx(input, ctx?): ParseContext
-
_getType
- _getType(input): string
-
Returns string
Abstract
_parse
- _parse(input): ParseReturnType<Output>
-
_parseAsync
- _parseAsync(input): AsyncParseReturnType<Output>
-
_parseSync
- _parseSync(input): SyncParseReturnType<Output>
-
_processInputParams
- _processInputParams(input): {
ctx: ParseContext;
status: ParseStatus;
}
-
_refinement
- _refinement(refinement): ZodEffects<ZodType<Output, Def, Input>, Output, Input>
-
Parameters
-
refinement: ((arg, ctx) => any)
-
- (arg, ctx): any
-
Returns any
Returns ZodEffects<ZodType<Output, Def, Input>, Output, Input>
and
- and<T>(incoming): ZodIntersection<ZodType<Output, Def, Input>, T>
-
array
- array(): ZodArray<ZodType<Output, Def, Input>, "many">
-
Returns ZodArray<ZodType<Output, Def, Input>, "many">
brand
- brand<B>(brand?): ZodBranded<ZodType<Output, Def, Input>, B>
-
Type Parameters
-
B extends string | number | symbol
catch
- catch(def): ZodCatch<ZodType<Output, Def, Input>>
-
- catch(def): ZodCatch<ZodType<Output, Def, Input>>
-
Parameters
-
def: ((ctx) => Output)
-
- (ctx): Output
-
Parameters
-
ctx: {
error: ZodError<any>;
input: Input;
}
Returns Output
default
- default(def): ZodDefault<ZodType<Output, Def, Input>>
-
- default(def): ZodDefault<ZodType<Output, Def, Input>>
-
describe
- describe(description): ZodType<Output, Def, Input>
-
Returns ZodType<Output, Def, Input>
isNullable
- isNullable(): boolean
-
Returns boolean
isOptional
- isOptional(): boolean
-
Returns boolean
nullable
- nullable(): ZodNullable<ZodType<Output, Def, Input>>
-
optional
- optional(): ZodOptional<ZodType<Output, Def, Input>>
-
or
- or<T>(option): ZodUnion<[ZodType<Output, Def, Input>, T]>
-
Returns ZodUnion<[ZodType<Output, Def, Input>, T]>
parse
- parse(data, params?): Output
-
Returns Output
parseAsync
- parseAsync(data, params?): Promise<Output>
-
Returns Promise<Output>
pipe
- pipe<T>(target): ZodPipeline<ZodType<Output, Def, Input>, T>
-
promise
- promise(): ZodPromise<ZodType<Output, Def, Input>>
-
refine
- refine<RefinedOutput>(check, message?): ZodEffects<ZodType<Output, Def, Input>, RefinedOutput, Input>
-
Parameters
-
check: ((arg) => arg is RefinedOutput)
-
- (arg): arg is RefinedOutput
-
Returns arg is RefinedOutput
-
Returns ZodEffects<ZodType<Output, Def, Input>, RefinedOutput, Input>
- refine(check, message?): ZodEffects<ZodType<Output, Def, Input>, Output, Input>
-
Parameters
-
check: ((arg) => unknown)
-
- (arg): unknown
-
Returns unknown
-
Returns ZodEffects<ZodType<Output, Def, Input>, Output, Input>
refinement
- refinement<RefinedOutput>(check, refinementData): ZodEffects<ZodType<Output, Def, Input>, RefinedOutput, Input>
-
Parameters
-
check: ((arg) => arg is RefinedOutput)
-
- (arg): arg is RefinedOutput
-
Returns arg is RefinedOutput
-
Returns ZodEffects<ZodType<Output, Def, Input>, RefinedOutput, Input>
- refinement(check, refinementData): ZodEffects<ZodType<Output, Def, Input>, Output, Input>
-
Parameters
-
check: ((arg) => boolean)
-
- (arg): boolean
-
Returns boolean
-
Returns ZodEffects<ZodType<Output, Def, Input>, Output, Input>
safeParse
- safeParse(data, params?): SafeParseReturnType<Input, Output>
-
safeParseAsync
- safeParseAsync(data, params?): Promise<SafeParseReturnType<Input, Output>>
-
superRefine
- superRefine<RefinedOutput>(refinement): ZodEffects<ZodType<Output, Def, Input>, RefinedOutput, Input>
-
Parameters
-
refinement: ((arg, ctx) => arg is RefinedOutput)
-
- (arg, ctx): arg is RefinedOutput
-
Returns arg is RefinedOutput
Returns ZodEffects<ZodType<Output, Def, Input>, RefinedOutput, Input>
- superRefine(refinement): ZodEffects<ZodType<Output, Def, Input>, Output, Input>
-
Parameters
-
refinement: ((arg, ctx) => void)
-
- (arg, ctx): void
-
Returns void
Returns ZodEffects<ZodType<Output, Def, Input>, Output, Input>
transform
- transform<NewOut>(transform): ZodEffects<ZodType<Output, Def, Input>, NewOut, Input>
-
Parameters
-
transform: ((arg, ctx) => NewOut | Promise<NewOut>)
-
- (arg, ctx): NewOut | Promise<NewOut>
-
Returns NewOut | Promise<NewOut>
Returns ZodEffects<ZodType<Output, Def, Input>, NewOut, Input>