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

Type Parameters

Hierarchy (view full)

Constructors

Properties

_input: Input
_output: Output
_type: 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?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>)

Alias of safeParseAsync

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

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

    • description: string

    Returns this

  • Returns boolean

  • Returns boolean

  • Returns ZodObject<{
        [k in string | number | symbol]: deoptional<T[k]>
    }, UnknownKeys, Catchall, objectOutputType<{
        [k in string | number | symbol]: deoptional<T[k]>
    }, Catchall, UnknownKeys>, objectInputType<{
        [k in string | number | symbol]: deoptional<T[k]>
    }, Catchall, UnknownKeys>>

  • Type Parameters

    • Mask extends Exactly<{
          [k in string | number | symbol]?: true
      }, Mask>

    Parameters

    Returns ZodObject<{
        [k in string | number | symbol]: k extends keyof T
            ? {
                [k in string | number | symbol]: k extends keyof Mask
                    ? deoptional<T[k<k>]>
                    : T[k]
            }[k<k>]
            : never
    }, UnknownKeys, Catchall, objectOutputType<{
        [k in string | number | symbol]: k extends keyof T
            ? {
                [k in string | number | symbol]: k extends keyof Mask
                    ? deoptional<T[k<k>]>
                    : T[k]
            }[k<k>]
            : never
    }, Catchall, UnknownKeys>, objectInputType<{
        [k in string | number | symbol]: k extends keyof T
            ? {
                [k in string | number | symbol]: k extends keyof Mask
                    ? deoptional<T[k<k>]>
                    : T[k]
            }[k<k>]
            : never
    }, Catchall, UnknownKeys>>