Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

ZodSchema

abstract
abstract class ZodSchema<Type, Def extends ZodTypeDef = ZodTypeDef> {
constructor(def: Def);
readonly _def: Def;
_refinement: (refinement: InternalCheck<Type>) => this;
readonly _type: Type;
array: () => ZodArray<this>;
nullable: () => ZodUnion<[this, ZodNull]>;
optional: () => ZodUnion<[this, ZodUndefined]>;
or: <U extends ZodType<any>>(arg: U) => ZodUnion<[this, U]>;
parse: (x: Type | unknown, params?: ParseParams) => Type;
parseAsync: (x: Type | unknown, params?: ParseParams) => Promise<Type>;
refine: <Func extends (arg: Type) => any>(check: Func, message?: string | Pick<Check<Type>, "path" | "message" | "params">) => this;
refinement: (refinement: Check<Type>) => this;
safeParse: (x: Type | unknown, params?: ParseParams) => {
success: true;
data: Type;
}
| {
success: false;
error: ZodError;
}
;
abstract toJSON: () => object;
 
check(u: Type | unknown): u is Type;
is(u: Type): u is Type;
}

§Type Parameters

§Constructors

§
new ZodSchema(def: Def)
[src]

§Properties

§
_def: Def
[src]
§
_refinement: (refinement: InternalCheck<Type>) => this
[src]
§
_type: Type
[src]
§
array: () => ZodArray<this>
[src]
§
nullable: () => ZodUnion<[this, ZodNull]>
[src]
§
optional: () => ZodUnion<[this, ZodUndefined]>
[src]
§
or: <U extends ZodType<any>>(arg: U) => ZodUnion<[this, U]>
[src]
§
parse: (x: Type | unknown, params?: ParseParams) => Type
[src]
§
parseAsync: (x: Type | unknown, params?: ParseParams) => Promise<Type>
[src]
§
refine: <Func extends (arg: Type) => any>(check: Func, message?: string | Pick<Check<Type>, "path" | "message" | "params">) => this
[src]
§
refinement: (refinement: Check<Type>) => this
[src]
§
safeParse: (x: Type | unknown, params?: ParseParams) => {
success: true;
data: Type;
}
| {
success: false;
error: ZodError;
}
[src]
§
toJSON: () => object
[src]

§Methods

§
check(u: Type | unknown): u is Type
[src]
§
is(u: Type): u is Type
[src]