x/zod/mod.ts

TypeScript-first schema validation with static type inference
Very Popular
Go to Latest
class ZodObject
extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input>
import { ZodObject } from "https://deno.land/x/zod@v3.17.3/mod.ts?s=ZodObject";

Type Parameters

T extends ZodRawShape[src]
optional
UnknownKeys extends UnknownKeysParam = "strip"
[src]
optional
Catchall extends ZodTypeAny = ZodTypeAny
[src]
optional
Output = objectOutputType<T, Catchall>
[src]
optional
Input = objectInputType<T, Catchall>
[src]

Properties

private
_cached: { shape: T; keys: string[]; } | null
[src]
readonly
_catchall: Catchall
[src]
readonly
_shape: T
[src]
readonly
_unknownKeys: UnknownKeys
[src]
augment[src]
extend[src]
deprecated
nonstrict
[src]
readonly
shape
[src]

Methods

_getCached(): { shape: T; keys: string[]; }[src]
_parse(input: ParseInput): ParseReturnType<this["_output"]>[src]
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>[src]
deepPartial(): partialUtil.DeepPartial<this>[src]
merge<Incoming extends AnyZodObject>(merging: Incoming): ZodObject<extendShape<T, Incoming["_shape"]>, UnknownKeys, Catchall>[src]

Prior to zod@1.0.12 there was a bug in the inferred type of merged objects. Please upgrade if you are experiencing issues.

omit<Mask extends [k in keyof T]?: true>(mask: Mask): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>[src]
partial(): ZodObject<[k in keyof T]: ZodOptional<T[k]>, UnknownKeys, Catchall>[src]
partial<Mask extends [k in keyof T]?: true>(mask: Mask): ZodObject<objectUtil.noNever<[k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k]>, UnknownKeys, Catchall>[src]
partial(mask?: any)[src]
passthrough(): ZodObject<T, "passthrough", Catchall>[src]
pick<Mask extends [k in keyof T]?: true>(mask: Mask): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>[src]
required(): ZodObject<[k in keyof T]: deoptional<T[k]>, UnknownKeys, Catchall>[src]
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & [k in Key]: Schema, UnknownKeys, Catchall>[src]
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>[src]
strip(): ZodObject<T, "strip", Catchall>[src]

Static Properties

create: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T>[src]
lazycreate: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T>[src]
strictCreate: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict">[src]