Class ZodObject<T, UnknownKeys, Catchall, Output, Input>

Type Parameters

Hierarchy (view full)

Constructors

Properties

_input: Input
_output: Output
_type: Output
~standard: Props<Input, Output>

Use .extend instead

nonstrict: (() => ZodObject<T, "passthrough", Catchall, objectOutputType<T, Catchall, "passthrough">, objectInputType<T, Catchall, "passthrough">>)

In most cases, this is no longer needed - unknown properties are now silently stripped. If you want to pass through unknown properties, use .passthrough() instead.

spa: ((data: unknown, params?: InexactPartial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>)

Alias of safeParseAsync

create: (<Shape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, {
    [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k]
}, {
    [k in string | number | symbol]: baseObjectInputType<Shape>[k]
}>)
lazycreate: (<Shape>(shape: (() => Shape), params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, {
    [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k]
}, {
    [k in string | number | symbol]: baseObjectInputType<Shape>[k]
}>)
strictCreate: (<Shape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict", ZodTypeAny, {
    [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k]
}, {
    [k in string | number | symbol]: baseObjectInputType<Shape>[k]
}>)

Accessors

  • get description(): undefined | string
  • Returns undefined | string

  • get shape(): T
  • Returns T

Methods

  • Returns {
        keys: string[];
        shape: T;
    }

    • keys: string[]
    • shape: T
  • Parameters

    Returns string

  • Parameters

    • data: unknown

    Returns Result<Output> | Promise<Result<Output>>

  • Parameters

    • description: string

    Returns this

  • Returns boolean

  • Returns boolean

  • Returns ZodEnum<CastToStringTuple<UnionToTuple<keyof T, []>>>