Skip to main content
Module

x/doz/mod.ts>ZodSchema

Deno-supporting branch of Zod, a TypeScript-first schema validation library with static type inference.
Latest
class ZodSchema
Abstract
import { ZodSchema } from "https://deno.land/x/doz@v3-snapshot-2021-01-21/mod.ts";

Constructors

new
ZodSchema(def: Def)

Type Parameters

Output
optional
Def extends ZodTypeDef = ZodTypeDef
optional
Input = Output

Properties

readonly
_def: Def
readonly
_input: Input
readonly
_output: Output
_refinement: (refinement: InternalCheck<Output>["check"]) => this
readonly
_type: Output
array: () => ZodArray<this>
check: never

The .check method has been removed in Zod 3. For details see https://github.com/colinhacks/zod/tree/v3.

clearEffects: <Out>() => ZodType<Out, Def, Input>
is: never

The .is method has been removed in Zod 3. For details see https://github.com/colinhacks/zod/tree/v3.

isNullable: () => boolean
isOptional: () => boolean
nullable: () => ZodNullableType<this>
optional: () => ZodOptionalType<this>
or
parse: (x: unknown, params?: ParseParams) => Output
parseAsync: (x: unknown, params?: ParseParams) => Promise<Output>
prependMod: <Out>(mod: (arg: Output) => Out | Promise<Out>) => ZodType<Out, Def, Input>
refine: <Func extends (arg: Output) => any>(check: Func, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)) => unknown
refinement: (check: (arg: Output) => any, refinementData: MakeErrorData | ((arg: Output, ctx: RefinementCtx) => MakeErrorData)) => unknown
safeParse: (x: unknown, params?: ParseParams) => { success: true; data: Output; } | { success: false; error: ZodError; }
safeParseAsync: (x: unknown, params?: ParseParams) => Promise<{ success: true; data: Output; } | { success: false; error: ZodError; }>
setEffects: <Out>(effects: Effect<any>[]) => ZodType<Out, Def, Input>
spa
abstract
toJSON: () => object
transform: <Out, This extends this>(transformer: (arg: Output) => Out | Promise<Out>) => This extends ZodTransformer<infer T, any> ? ZodTransformer<T, Out> : ZodTransformer<This, Out>

Methods

default<T extends Input, This extends this = this>(def: T): ZodTransformer<ZodOptional<This>, Input>
default<T extends (arg: this) => Input, This extends this = this>(def: T): ZodTransformer<ZodOptional<This>, Input>