import { z } from "https://deno.land/x/zod@v3.2/mod.ts";
const { ZodSchema } = z;
Constructors
new
ZodSchema(def: Def)Properties
readonly
_def: Defreadonly
_input: Inputreadonly
_output: Output_parseInternalOptionalParams: (params: ParseParamsWithOptionals) => ZodParserReturnType<Output>
_parseWithInvalidFallback: (data: unknown, params: ParseParamsNoData) => Promise<Output | INVALID> | Output | INVALID
readonly
_type: Outputarray: () => ZodArray<this>
The .check method has been removed in Zod 3. For details see https://github.com/colinhacks/zod/tree/v3.
The .is method has been removed in Zod 3. For details see https://github.com/colinhacks/zod/tree/v3.
nullable: <This extends this = this>() => ZodNullable<This>
nullish: <This extends this = this>() => ZodNullable<ZodOptional<This>>
optional: <This extends this = this>() => ZodOptional<This>
parse: (data: unknown, params?: Partial<ParseParamsNoData>) => Output
parseAsync: (x: unknown, params?: Partial<ParseParamsNoData>) => Promise<Output>
refine: <Func extends (arg: Output) => any, This extends this = this>(check: Func, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)) => ZodEffectsType<This>
refinement: <This extends this = this>(check: (arg: Output) => any, refinementData: MakeErrorData | ((arg: Output, ctx: RefinementCtx) => MakeErrorData)) => ZodEffectsType<This>
safeParse: (data: unknown, params?: Partial<ParseParamsNoData>) => { success: true; data: Output; } | { success: false; error: ZodError<Input>; }
safeParseAsync: (x: unknown, params?: Partial<ParseParamsNoData>) => Promise<{ success: true; data: Output; } | { success: false; error: ZodError; }>
Methods
abstract
_parse(_ctx: ParseContext): any_parseInternal(params: ParseParams): ZodParserReturnType<Output>
_refinement<This extends this>(refinement: InternalCheck<Output>["refinement"]): ZodEffectsType<This>
and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>
default<This extends this = this>(def: util.noUndefined<Input>): ZodDefault<This>
default<This extends this = this>(def: () => util.noUndefined<Input>): ZodDefault<This>
default(def: any)
or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>
transform<NewOut>(transform: (arg: Output) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>