Module

x/zod/external.ts>ZodObject

TypeScript-first schema validation with static type inference
Extremely Popular
Go to Latest
class ZodObject
import { ZodObject } from "https://dotland.deno.dev/x/zod@v3.22.2/external.ts";

Type Parameters

T extends ZodRawShape
optional
UnknownKeys extends UnknownKeysParam = UnknownKeysParam
optional
Catchall extends ZodTypeAny = ZodTypeAny

Properties

private
_cached: { shape: T; keys: string[]; } | null
deprecated
augment
deprecated
nonstrict
readonly
shape

Methods

_getCached(): { shape: T; keys: string[]; }
_parse(input: ParseInput): ParseReturnType<this["_output"]>
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>
deprecated
deepPartial(): partialUtil.DeepPartial<this>
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>

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>
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>
passthrough(): ZodObject<T, "passthrough", Catchall>
pick<Mask extends [k in keyof T]?: true>(mask: Mask): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>
required<Mask extends [k in keyof T]?: true>(mask: Mask): ZodObject<objectUtil.noNever<[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k]>, UnknownKeys, Catchall>
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & [k in Key]: Schema, UnknownKeys, Catchall>
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>
strip(): ZodObject<T, "strip", Catchall>

Static Properties

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