@morojs/moro / z / ZodObject
Interface: ZodObject<Shape, Config>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:415
Extends
_ZodType
<$ZodObjectInternals
<Shape
,Config
>>.$ZodObject
<Shape
,Config
>
Type Parameters
Shape
Shape
extends $ZodShape
= $ZodLooseShape
Config
Config
extends $ZodObjectConfig
= $strip
Properties
~~_def~~
_def:
$ZodObjectDef
<Shape
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:8
Deprecated
Use .def
instead.
Inherited from
~~_input~~
_input:
$InferObjectInput
<Shape
,Config
["in"
]>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:12
Deprecated
Use z.input<typeof schema>
instead.
Inherited from
~~_output~~
_output:
$InferObjectOutput
<Shape
,Config
["out"
]>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:10
Deprecated
Use z.output<typeof schema>
instead.
Inherited from
_zod
_zod:
$ZodObjectInternals
Defined in: node_modules/zod/v4/core/schemas.d.cts:89
Inherited from
~standard
~standard:
$ZodStandardSchema
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/core/schemas.d.cts:90
Inherited from
def
def:
$ZodObjectDef
<Shape
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:5
Inherited from
description?
optional
description:string
Defined in: node_modules/zod/v4/classic/schemas.d.cts:53
Inherited from
shape
shape:
Shape
Defined in: node_modules/zod/v4/classic/schemas.d.cts:418
spa()
spa: (
data
,params?
) =>Promise
<ZodSafeParseResult
<$InferObjectOutput
<Shape
,Config
["out"
]>>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:23
Parameters
data
unknown
params?
Returns
Promise
<ZodSafeParseResult
<$InferObjectOutput
<Shape
, Config
["out"
]>>>
Inherited from
type
type:
"object"
Defined in: node_modules/zod/v4/classic/schemas.d.cts:6
Inherited from
Methods
and()
and<
T
>(incoming
):ZodIntersection
<ZodObject
<Shape
,Config
>,T
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:45
Type Parameters
T
T
extends SomeType
Parameters
incoming
T
Returns
ZodIntersection
<ZodObject
<Shape
, Config
>, T
>
Inherited from
array()
array():
ZodArray
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:43
Returns
ZodArray
<ZodObject
<Shape
, Config
>>
Inherited from
brand()
brand<
T
>(value?
):PropertyKey
extendsT
?ZodObject
<Shape
,Config
> :$ZodBranded
<ZodObject
<Shape
,Config
>,T
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:18
Type Parameters
T
T
extends PropertyKey
= PropertyKey
Parameters
value?
T
Returns
PropertyKey
extends T
? ZodObject
<Shape
, Config
> : $ZodBranded
<ZodObject
<Shape
, Config
>, T
>
Inherited from
catch()
Call Signature
catch(
def
):ZodCatch
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:47
Parameters
def
$InferObjectOutput
<Shape
>
Returns
ZodCatch
<ZodObject
<Shape
, Config
>>
Inherited from
Call Signature
catch(
def
):ZodCatch
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:48
Parameters
def
(ctx
) => $InferObjectOutput
<Shape
>
Returns
ZodCatch
<ZodObject
<Shape
, Config
>>
Inherited from
catchall()
catchall<
T
>(schema
):ZodObject
<Shape
,$catchall
<T
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:421
Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior.
Type Parameters
T
T
extends SomeType
Parameters
schema
T
Returns
ZodObject
<Shape
, $catchall
<T
>>
check()
check(...
checks
):this
Defined in: node_modules/zod/v4/classic/schemas.d.cts:13
Parameters
checks
...(CheckFn
<$InferObjectOutput
<Shape
, Config
["out"
]>> | $ZodCheck
<$InferObjectOutput
<Shape
, Config
["out"
]>>)[]
Returns
this
Inherited from
clone()
clone(
def?
,params?
):this
Defined in: node_modules/zod/v4/classic/schemas.d.cts:14
Parameters
def?
$ZodObjectDef
<Shape
>
params?
parent
boolean
Returns
this
Inherited from
decode()
decode(
data
,params?
):$InferObjectOutput
<Shape
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:25
Parameters
data
$InferObjectInput
<Shape
>
params?
Returns
$InferObjectOutput
<Shape
>
Inherited from
decodeAsync()
decodeAsync(
data
,params?
):Promise
<$InferObjectOutput
<Shape
,Config
["out"
]>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:27
Parameters
data
$InferObjectInput
<Shape
>
params?
Returns
Promise
<$InferObjectOutput
<Shape
, Config
["out"
]>>
Inherited from
default()
Call Signature
default(
def
):ZodDefault
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:39
Parameters
def
$InferObjectOutput
<Shape
>
Returns
ZodDefault
<ZodObject
<Shape
, Config
>>
Inherited from
Call Signature
default(
def
):ZodDefault
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:40
Parameters
def
() => NoUndefined
<$InferObjectOutput
<Shape
, Config
["out"
]>>
Returns
ZodDefault
<ZodObject
<Shape
, Config
>>
Inherited from
describe()
describe(
description
):this
Defined in: node_modules/zod/v4/classic/schemas.d.cts:52
Returns a new instance that has been registered in z.globalRegistry
with the specified description
Parameters
description
string
Returns
this
Inherited from
encode()
encode(
data
,params?
):$InferObjectInput
<Shape
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:24
Parameters
data
$InferObjectOutput
<Shape
>
params?
Returns
$InferObjectInput
<Shape
>
Inherited from
encodeAsync()
encodeAsync(
data
,params?
):Promise
<$InferObjectInput
<Shape
,Config
["in"
]>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:26
Parameters
data
$InferObjectOutput
<Shape
>
params?
Returns
Promise
<$InferObjectInput
<Shape
, Config
["in"
]>>
Inherited from
extend()
extend<
U
>(shape
):ZodObject
<{ [k in string | number | symbol]: ((keyof Shape & keyof U) extends never ? Shape & U : { [K in string | number | symbol as K extends keyof U ? never : K]: Shape[K] } & { [K in string | number | symbol]: U[K] })[k] },Config
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:430
Type Parameters
U
U
extends $ZodLooseShape
Parameters
shape
U
Returns
ZodObject
<{ [k in string | number | symbol]: ((keyof Shape & keyof U) extends never ? Shape & U : { [K in string | number | symbol as K extends keyof U ? never : K]: Shape[K] } & { [K in string | number | symbol]: U[K] })[k] }, Config
>
~~isNullable()~~
isNullable():
boolean
Defined in: node_modules/zod/v4/classic/schemas.d.cts:74
Returns
boolean
Deprecated
Try safe-parsing null
(this is what isNullable
does internally):
const schema = z.string().nullable(); const isNullable = schema.safeParse(null).success; // true
Inherited from
~~isOptional()~~
isOptional():
boolean
Defined in: node_modules/zod/v4/classic/schemas.d.cts:65
Returns
boolean
Deprecated
Try safe-parsing undefined
(this is what isOptional
does internally):
const schema = z.string().optional(); const isOptional = schema.safeParse(undefined).success; // true
Inherited from
keyof()
keyof():
ZodEnum
<{ [k in string]: { [k in string]: k }[k] }
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:419
Returns
ZodEnum
<{ [k in string]: { [k in string]: k }[k] }
>
loose()
loose():
ZodObject
<Shape
,$loose
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:425
Consider z.looseObject(A.shape)
instead
Returns
ZodObject
<Shape
, $loose
>
~~merge()~~
merge<
U
>(other
):ZodObject
<{ [k in string | number | symbol]: ((keyof Shape & keyof U["shape"]) extends never ? Shape & U["shape"] : { [K in string | number | symbol as K extends keyof U["shape"] ? never : K]: Shape[K] } & { [K in string | number | symbol]: U["shape"][K] })[k] },U
["_zod"
]["config"
]>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:435
Type Parameters
U
U
extends ZodObject
<$ZodLooseShape
, $strip
>
Parameters
other
U
Returns
ZodObject
<{ [k in string | number | symbol]: ((keyof Shape & keyof U["shape"]) extends never ? Shape & U["shape"] : { [K in string | number | symbol as K extends keyof U["shape"] ? never : K]: Shape[K] } & { [K in string | number | symbol]: U["shape"][K] })[k] }, U
["_zod"
]["config"
]>
Deprecated
Use A.extend(B.shape)
instead.
meta()
Call Signature
meta():
undefined
| {[key
:string
]:unknown
;deprecated?
:boolean
;description?
:string
;id?
:string
;title?
:string
; }
Defined in: node_modules/zod/v4/classic/schemas.d.cts:55
Returns the metadata associated with this instance in z.globalRegistry
Returns
undefined
| {[key
: string
]: unknown
; deprecated?
: boolean
; description?
: string
; id?
: string
; title?
: string
; }
Inherited from
Call Signature
meta(
data
):this
Defined in: node_modules/zod/v4/classic/schemas.d.cts:57
Returns a new instance that has been registered in z.globalRegistry
with the specified metadata
Parameters
data
deprecated?
boolean
description?
string
id?
string
title?
string
Returns
this
Inherited from
nonoptional()
nonoptional(
params?
):ZodNonOptional
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:36
Parameters
params?
string
|
{ error?
: string
| $ZodErrorMap
<$ZodIssueInvalidType
<unknown
>>; message?
: string
; }
error?
string
| $ZodErrorMap
<$ZodIssueInvalidType
<unknown
>>
message?
string
Deprecated
This parameter is deprecated. Use error
instead.
Returns
ZodNonOptional
<ZodObject
<Shape
, Config
>>
Inherited from
nullable()
nullable():
ZodNullable
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:37
Returns
ZodNullable
<ZodObject
<Shape
, Config
>>
Inherited from
nullish()
nullish():
ZodOptional
<ZodNullable
<ZodObject
<Shape
,Config
>>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:38
Returns
ZodOptional
<ZodNullable
<ZodObject
<Shape
, Config
>>>
Inherited from
omit()
omit<
M
>(mask
):ZodObject
<{ [k in string | number | symbol]: Omit<Shape, Extract<keyof Shape, keyof M>>[k] },Config
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:437
Type Parameters
M
M
extends Mask
<keyof Shape
>
Parameters
mask
M
Returns
ZodObject
<{ [k in string | number | symbol]: Omit<Shape, Extract<keyof Shape, keyof M>>[k] }, Config
>
optional()
optional():
ZodOptional
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:35
Returns
ZodOptional
<ZodObject
<Shape
, Config
>>
Inherited from
or()
or<
T
>(option
):ZodUnion
<[ZodObject
<Shape
,Config
>,T
]>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:44
Type Parameters
T
T
extends SomeType
Parameters
option
T
Returns
ZodUnion
<[ZodObject
<Shape
, Config
>, T
]>
Inherited from
overwrite()
overwrite(
fn
):this
Defined in: node_modules/zod/v4/classic/schemas.d.cts:34
Parameters
fn
(x
) => $InferObjectOutput
<Shape
>
Returns
this
Inherited from
parse()
parse(
data
,params?
):$InferObjectOutput
<Shape
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:19
Parameters
data
unknown
params?
Returns
$InferObjectOutput
<Shape
>
Inherited from
parseAsync()
parseAsync(
data
,params?
):Promise
<$InferObjectOutput
<Shape
,Config
["out"
]>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:21
Parameters
data
unknown
params?
Returns
Promise
<$InferObjectOutput
<Shape
, Config
["out"
]>>
Inherited from
partial()
Call Signature
partial():
ZodObject
<{ [k in string | number | symbol]: ZodOptional<Shape[k]> },Config
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:438
Returns
ZodObject
<{ [k in string | number | symbol]: ZodOptional<Shape[k]> }, Config
>
Call Signature
partial<
M
>(mask
):ZodObject
<{ [k in string | number | symbol]: k extends keyof M ? ZodOptional<Shape[k<k>]> : Shape[k] },Config
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:441
Type Parameters
M
M
extends Mask
<keyof Shape
>
Parameters
mask
M
Returns
ZodObject
<{ [k in string | number | symbol]: k extends keyof M ? ZodOptional<Shape[k<k>]> : Shape[k] }, Config
>
~~passthrough()~~
passthrough():
ZodObject
<Shape
,$loose
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:423
Returns
ZodObject
<Shape
, $loose
>
Deprecated
Use z.looseObject()
or .loose()
instead.
pick()
pick<
M
>(mask
):ZodObject
<{ [k in string | number | symbol]: Pick<Shape, Extract<keyof Shape, keyof M>>[k] },Config
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:436
Type Parameters
M
M
extends Mask
<keyof Shape
>
Parameters
mask
M
Returns
ZodObject
<{ [k in string | number | symbol]: Pick<Shape, Extract<keyof Shape, keyof M>>[k] }, Config
>
pipe()
pipe<
T
>(target
):ZodPipe
<ZodObject
<Shape
,Config
>,T
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:49
Type Parameters
T
T
extends $ZodType
<any
, $InferObjectOutput
<Shape
, Config
["out"
]>, $ZodTypeInternals
<any
, $InferObjectOutput
<Shape
, Config
["out"
]>>>
Parameters
target
T
| $ZodType
<any
, $InferObjectOutput
<Shape
, Config
["out"
]>, $ZodTypeInternals
<any
, $InferObjectOutput
<Shape
, Config
["out"
]>>>
Returns
ZodPipe
<ZodObject
<Shape
, Config
>, T
>
Inherited from
prefault()
Call Signature
prefault(
def
):ZodPrefault
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:41
Parameters
def
() => $InferObjectInput
<Shape
>
Returns
ZodPrefault
<ZodObject
<Shape
, Config
>>
Inherited from
Call Signature
prefault(
def
):ZodPrefault
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:42
Parameters
def
$InferObjectInput
<Shape
>
Returns
ZodPrefault
<ZodObject
<Shape
, Config
>>
Inherited from
readonly()
readonly():
ZodReadonly
<ZodObject
<Shape
,Config
>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:50
Returns
ZodReadonly
<ZodObject
<Shape
, Config
>>
Inherited from
refine()
refine(
check
,params?
):this
Defined in: node_modules/zod/v4/classic/schemas.d.cts:32
Parameters
check
(arg
) => unknown
params?
string
|
{ abort?
: boolean
; error?
: string
| $ZodErrorMap
<NonNullable
<$ZodIssue
>>; message?
: string
; params?
: Record
<string
, any
>; path?
: PropertyKey
[]; when?
: (payload
) => boolean
; }
abort?
boolean
If true, no later checks will be executed if this check fails. Default false
.
error?
string
| $ZodErrorMap
<NonNullable
<$ZodIssue
>>
message?
string
Deprecated
This parameter is deprecated. Use error
instead.
params?
Record
<string
, any
>
path?
PropertyKey
[]
when?
(payload
) => boolean
If provided, this check will only be executed if the function returns true
. Defaults to payload => z.util.isAborted(payload)
.
Returns
this
Inherited from
register()
register<
R
>(registry
, ...meta
):this
Defined in: node_modules/zod/v4/classic/schemas.d.cts:17
Type Parameters
R
R
extends $ZodRegistry
<MetadataType
, $ZodType
<unknown
, unknown
, $ZodTypeInternals
<unknown
, unknown
>>>
Parameters
registry
R
meta
...ZodObject
<Shape
, Config
> extends R
["_schema"
] ? undefined
extends R
["_meta"
] ? [$replace
<R
["_meta"
], R
["_schema"
] & ZodObject
<Shape
, Config
>>?] : [$replace
<R
["_meta"
], R
["_schema"
] & ZodObject
<Shape
, Config
>>] : ["Incompatible schema"
]
Returns
this
Inherited from
required()
Call Signature
required():
ZodObject
<{ [k in string | number | symbol]: ZodNonOptional<Shape[k]> },Config
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:444
Returns
ZodObject
<{ [k in string | number | symbol]: ZodNonOptional<Shape[k]> }, Config
>
Call Signature
required<
M
>(mask
):ZodObject
<{ [k in string | number | symbol]: k extends keyof M ? ZodNonOptional<Shape[k<k>]> : Shape[k] },Config
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:447
Type Parameters
M
M
extends Mask
<keyof Shape
>
Parameters
mask
M
Returns
ZodObject
<{ [k in string | number | symbol]: k extends keyof M ? ZodNonOptional<Shape[k<k>]> : Shape[k] }, Config
>
safeDecode()
safeDecode(
data
,params?
):ZodSafeParseResult
<$InferObjectOutput
<Shape
,Config
["out"
]>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:29
Parameters
data
$InferObjectInput
<Shape
>
params?
Returns
ZodSafeParseResult
<$InferObjectOutput
<Shape
, Config
["out"
]>>
Inherited from
safeDecodeAsync()
safeDecodeAsync(
data
,params?
):Promise
<ZodSafeParseResult
<$InferObjectOutput
<Shape
,Config
["out"
]>>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:31
Parameters
data
$InferObjectInput
<Shape
>
params?
Returns
Promise
<ZodSafeParseResult
<$InferObjectOutput
<Shape
, Config
["out"
]>>>
Inherited from
safeEncode()
safeEncode(
data
,params?
):ZodSafeParseResult
<$InferObjectInput
<Shape
,Config
["in"
]>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:28
Parameters
data
$InferObjectOutput
<Shape
>
params?
Returns
ZodSafeParseResult
<$InferObjectInput
<Shape
, Config
["in"
]>>
Inherited from
safeEncodeAsync()
safeEncodeAsync(
data
,params?
):Promise
<ZodSafeParseResult
<$InferObjectInput
<Shape
,Config
["in"
]>>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:30
Parameters
data
$InferObjectOutput
<Shape
>
params?
Returns
Promise
<ZodSafeParseResult
<$InferObjectInput
<Shape
, Config
["in"
]>>>
Inherited from
safeExtend()
safeExtend<
U
>(shape
):ZodObject
<{ [k in string | number | symbol]: ((keyof Shape & keyof U) extends never ? Shape & U : { [K in string | number | symbol as K extends keyof U ? never : K]: Shape[K] } & { [K in string | number | symbol]: U[K] })[k] },Config
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:431
Type Parameters
U
U
extends $ZodLooseShape
Parameters
shape
SafeExtendShape
<Shape
, U
> & Partial
<Record
<keyof Shape
, SomeType
>>
Returns
ZodObject
<{ [k in string | number | symbol]: ((keyof Shape & keyof U) extends never ? Shape & U : { [K in string | number | symbol as K extends keyof U ? never : K]: Shape[K] } & { [K in string | number | symbol]: U[K] })[k] }, Config
>
safeParse()
safeParse(
data
,params?
):ZodSafeParseResult
<$InferObjectOutput
<Shape
,Config
["out"
]>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:20
Parameters
data
unknown
params?
Returns
ZodSafeParseResult
<$InferObjectOutput
<Shape
, Config
["out"
]>>
Inherited from
safeParseAsync()
safeParseAsync(
data
,params?
):Promise
<ZodSafeParseResult
<$InferObjectOutput
<Shape
,Config
["out"
]>>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:22
Parameters
data
unknown
params?
Returns
Promise
<ZodSafeParseResult
<$InferObjectOutput
<Shape
, Config
["out"
]>>>
Inherited from
strict()
strict():
ZodObject
<Shape
,$strict
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:427
Consider z.strictObject(A.shape)
instead
Returns
ZodObject
<Shape
, $strict
>
strip()
strip():
ZodObject
<Shape
,$strip
>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:429
This is the default behavior. This method call is likely unnecessary.
Returns
ZodObject
<Shape
, $strip
>
superRefine()
superRefine(
refinement
):this
Defined in: node_modules/zod/v4/classic/schemas.d.cts:33
Parameters
refinement
(arg
, ctx
) => void
| Promise
<void
>
Returns
this
Inherited from
transform()
transform<
NewOut
>(transform
):ZodPipe
<ZodObject
<Shape
,Config
>,ZodTransform
<Awaited
<NewOut
>,$InferObjectOutput
<Shape
,Config
["out"
]>>>
Defined in: node_modules/zod/v4/classic/schemas.d.cts:46
Type Parameters
NewOut
NewOut
Parameters
transform
(arg
, ctx
) => NewOut
| Promise
<NewOut
>
Returns
ZodPipe
<ZodObject
<Shape
, Config
>, ZodTransform
<Awaited
<NewOut
>, $InferObjectOutput
<Shape
, Config
["out"
]>>>