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

Type Parameters

Hierarchy

Constructors

Properties

_cached: any
_def: ZodObjectDef<T, UnknownKeys, Catchall>
_input: Input
_output: Output
_type: Output
augment: (<Augmentation>(augmentation: Augmentation) => ZodObject<extendShape<T, Augmentation>, UnknownKeys, Catchall, objectOutputType<extendShape<T, Augmentation>, Catchall>, objectInputType<extendShape<T, Augmentation>, Catchall>>)

Type declaration

extend: (<Augmentation>(augmentation: Augmentation) => ZodObject<extendShape<T, Augmentation>, UnknownKeys, Catchall, objectOutputType<extendShape<T, Augmentation>, Catchall>, objectInputType<extendShape<T, Augmentation>, Catchall>>)

Type declaration

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

Type declaration

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

Type declaration

create: (<T_1>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [ k_1 in string | number | symbol]: addQuestionMarks<{ [ k in string | number | symbol]: T_1[k]["_output"] }>[k_1] }, { [ k_3 in string | number | symbol]: addQuestionMarks<{ [ k_2 in string | number | symbol]: T_1[k_2]["_input"] }>[k_3] }>)

Type declaration

lazycreate: (<T_1>(shape: (() => T_1), params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [ k_1 in string | number | symbol]: addQuestionMarks<{ [ k in string | number | symbol]: T_1[k]["_output"] }>[k_1] }, { [ k_3 in string | number | symbol]: addQuestionMarks<{ [ k_2 in string | number | symbol]: T_1[k_2]["_input"] }>[k_3] }>)

Type declaration

    • <T_1>(shape: (() => T_1), params?: RawCreateParams): ZodObject<T_1, "strip", ZodTypeAny, { [ k_1 in string | number | symbol]: addQuestionMarks<{ [ k in string | number | symbol]: T_1[k]["_output"] }>[k_1] }, { [ k_3 in string | number | symbol]: addQuestionMarks<{ [ k_2 in string | number | symbol]: T_1[k_2]["_input"] }>[k_3] }>
    • Type Parameters

      Parameters

      Returns ZodObject<T_1, "strip", ZodTypeAny, { [ k_1 in string | number | symbol]: addQuestionMarks<{ [ k in string | number | symbol]: T_1[k]["_output"] }>[k_1] }, { [ k_3 in string | number | symbol]: addQuestionMarks<{ [ k_2 in string | number | symbol]: T_1[k_2]["_input"] }>[k_3] }>

strictCreate: (<T_1>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, { [ k_1 in string | number | symbol]: addQuestionMarks<{ [ k in string | number | symbol]: T_1[k]["_output"] }>[k_1] }, { [ k_3 in string | number | symbol]: addQuestionMarks<{ [ k_2 in string | number | symbol]: T_1[k_2]["_input"] }>[k_3] }>)

Type declaration

Accessors

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

  • get shape(): T
  • Returns T

Methods

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

    • keys: string[]
    • shape: T
  • Returns ZodArray<ZodObject<T, UnknownKeys, Catchall, Output, Input>, "many">

  • Type Parameters

    • B extends string | number | symbol

    Parameters

    • Optional brand: B

    Returns ZodBranded<ZodObject<T, UnknownKeys, Catchall, Output, Input>, B>

  • Parameters

    • def: Input

    Returns ZodCatch<ZodObject<T, UnknownKeys, Catchall, Output, Input>>

  • Parameters

    • def: (() => Input)
        • (): Input
        • Returns Input

    Returns ZodCatch<ZodObject<T, UnknownKeys, Catchall, Output, Input>>

  • Parameters

    • description: string

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

  • Returns boolean

  • Returns boolean

  • Type Parameters

    • T extends ZodType<any, any, any, T>

    Parameters

    • option: T

    Returns ZodUnion<[ZodObject<T, UnknownKeys, Catchall, Output, Input>, T]>

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

  • Type Parameters

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

    Parameters

    • mask: Mask

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

  • Type Parameters

    • T extends ZodType<any, any, any, T>

    Parameters

    • target: T

    Returns ZodPipeline<ZodObject<T, UnknownKeys, Catchall, Output, Input>, T>

  • Type Parameters

    • RefinedOutput

    Parameters

    • check: ((arg: Output) => arg is RefinedOutput)
        • (arg: Output): arg is RefinedOutput
        • Parameters

          • arg: Output

          Returns arg is RefinedOutput

    • refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)

    Returns ZodEffects<ZodObject<T, UnknownKeys, Catchall, Output, Input>, RefinedOutput, Input>

  • Parameters

    • check: ((arg: Output) => boolean)
        • (arg: Output): boolean
        • Parameters

          • arg: Output

          Returns boolean

    • refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)

    Returns ZodEffects<ZodObject<T, UnknownKeys, Catchall, Output, Input>, Output, Input>

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

  • Type Parameters

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

    Parameters

    • mask: Mask

    Returns ZodObject<{ [ k in string | number | symbol]: k extends keyof T ? { [ k in string | number | symbol]: k extends keyof Mask ? deoptional<T[k]> : T[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]> : T[k] }[k] : never }, Catchall>, objectInputType<{ [ k in string | number | symbol]: k extends keyof T ? { [ k in string | number | symbol]: k extends keyof Mask ? deoptional<T[k]> : T[k] }[k] : never }, Catchall>>

  • Type Parameters

    • Key extends string

    • Schema extends ZodType<any, any, any, Schema>

    Parameters

    • key: Key
    • schema: Schema

    Returns ZodObject<T & { [ k in string]: Schema }, UnknownKeys, Catchall, objectOutputType<T & { [ k in string]: Schema }, Catchall>, objectInputType<T & { [ k in string]: Schema }, Catchall>>

  • Type Parameters

    • NewOut

    Parameters

    • transform: ((arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>)
        • (arg: Output, ctx: RefinementCtx): NewOut | Promise<NewOut>
        • Parameters

          Returns NewOut | Promise<NewOut>

    Returns ZodEffects<ZodObject<T, UnknownKeys, Catchall, Output, Input>, NewOut, Input>

Generated using TypeDoc