title: Core.z. Zod Object
A2A Node SDK - v0.1.0 / Modules / Core / z / ZodObject
Class: ZodObject<T, UnknownKeys, Catchall, Output, Input>
Type parameters
Name | Type |
---|---|
T | extends ZodRawShape |
UnknownKeys | extends UnknownKeysParam = UnknownKeysParam |
Catchall | extends ZodTypeAny = ZodTypeAny |
Output | objectOutputType <T , Catchall , UnknownKeys > |
Input | objectInputType <T , Catchall , UnknownKeys > |
Hierarchy
-
ZodType
<Output
,ZodObjectDef
<T
,UnknownKeys
,Catchall
>,Input
>↳
ZodObject
Table of contents
Constructors
Properties
Accessors
Methods
- _getCached
- _getOrReturnCtx
- _getType
- _parse
- _parseAsync
- _parseSync
- _processInputParams
- _refinement
- and
- array
- brand
- catch
- catchall
- deepPartial
- default
- describe
- extend
- isNullable
- isOptional
- keyof
- merge
- nullable
- nullish
- omit
- optional
- or
- parse
- parseAsync
- partial
- passthrough
- pick
- pipe
- promise
- readonly
- refine
- refinement
- required
- safeParse
- safeParseAsync
- setKey
- strict
- strip
- superRefine
- transform
- ~validate
Constructors
constructor
• new ZodObject<T
, UnknownKeys
, Catchall
, Output
, Input
>(def
): ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>
Type parameters
Name | Type |
---|---|
T | extends ZodRawShape |
UnknownKeys | extends UnknownKeysParam = UnknownKeysParam |
Catchall | extends ZodTypeAny = ZodTypeAny |
Output | objectOutputType <T , Catchall , UnknownKeys > |
Input | objectInputType <T , Catchall , UnknownKeys > |
Parameters
Name | Type |
---|---|
def | ZodObjectDef <T , UnknownKeys , Catchall > |
Returns
ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>
Inherited from
Properties
_def
• Readonly
_def: ZodObjectDef
<T
, UnknownKeys
, Catchall
>
Inherited from
_input
• Readonly
_input: Input
Inherited from
_output
• Readonly
_output: Output
Inherited from
_type
• Readonly
_type: Output
Inherited from
augment
• augment: <Augmentation>(augmentation
: Augmentation
) => ZodObject
<extendShape
<T
, Augmentation
>, UnknownKeys
, Catchall
, objectOutputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>, objectInputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>>
Deprecated
Use .extend
instead
Type declaration
▸ <Augmentation
>(augmentation
): ZodObject
<extendShape
<T
, Augmentation
>, UnknownKeys
, Catchall
, objectOutputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>, objectInputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>>
Type parameters
Name | Type |
---|---|
Augmentation | extends ZodRawShape |
Parameters
Name | Type |
---|---|
augmentation | Augmentation |
Returns
ZodObject
<extendShape
<T
, Augmentation
>, UnknownKeys
, Catchall
, objectOutputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>, objectInputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>>
create
▪ Static
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] }>
Type declaration
▸ <Shape
>(shape
, params?
): ZodObject
<Shape
, "strip"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
Parameters
Name | Type |
---|---|
shape | Shape |
params? | RawCreateParams |
Returns
ZodObject
<Shape
, "strip"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
lazycreate
▪ Static
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] }>
Type declaration
▸ <Shape
>(shape
, params?
): ZodObject
<Shape
, "strip"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
Parameters
Name | Type |
---|---|
shape | () => Shape |
params? | RawCreateParams |
Returns
ZodObject
<Shape
, "strip"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
nonstrict
• nonstrict: () => ZodObject
<T
, "passthrough"
, Catchall
, objectOutputType
<T
, Catchall
, "passthrough"
>, objectInputType
<T
, Catchall
, "passthrough"
>>
Deprecated
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.
Type declaration
▸ (): ZodObject
<T
, "passthrough"
, Catchall
, objectOutputType
<T
, Catchall
, "passthrough"
>, objectInputType
<T
, Catchall
, "passthrough"
>>
Returns
ZodObject
<T
, "passthrough"
, Catchall
, objectOutputType
<T
, Catchall
, "passthrough"
>, objectInputType
<T
, Catchall
, "passthrough"
>>
spa
• spa: (data
: unknown
, params?
: InexactPartial
<ParseParams
>) => Promise
<SafeParseReturnType
<Input
, Output
>>
Alias of safeParseAsync
Type declaration
▸ (data
, params?
): Promise
<SafeParseReturnType
<Input
, Output
>>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<SafeParseReturnType
<Input
, Output
>>
Inherited from
strictCreate
▪ Static
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] }>
Type declaration
▸ <Shape
>(shape
, params?
): ZodObject
<Shape
, "strict"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
Type parameters
Name | Type |
---|---|
Shape | extends ZodRawShape |
Parameters
Name | Type |
---|---|
shape | Shape |
params? | RawCreateParams |
Returns
ZodObject
<Shape
, "strict"
, ZodTypeAny
, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<Shape>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<Shape>[k] }>
~standard
• ~standard: Props
<Input
, Output
>
Inherited from
Accessors
description
• get
description(): undefined
| string
Returns
undefined
| string
Inherited from
ZodType.description
shape
• get
shape(): T
Returns
T
Methods
_getCached
▸ _getCached(): Object
Returns
Object
Name | Type |
---|---|
keys | string [] |
shape | T |
_getOrReturnCtx
▸ _getOrReturnCtx(input
, ctx?
): ParseContext
Parameters
Name | Type |
---|---|
input | ParseInput |
ctx? | ParseContext |
Returns
Inherited from
_getType
▸ _getType(input
): string
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
string
Inherited from
_parse
▸ _parse(input
): ParseReturnType
<Output
>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
ParseReturnType
<Output
>
Overrides
_parseAsync
▸ _parseAsync(input
): AsyncParseReturnType
<Output
>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
AsyncParseReturnType
<Output
>
Inherited from
_parseSync
▸ _parseSync(input
): SyncParseReturnType
<Output
>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
SyncParseReturnType
<Output
>
Inherited from
_processInputParams
▸ _processInputParams(input
): Object
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
Object
Name | Type |
---|---|
ctx | ParseContext |
status | ParseStatus |
Inherited from
_refinement
▸ _refinement(refinement
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Parameters
Name | Type |
---|---|
refinement | (arg : Output , ctx : RefinementCtx ) => any |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Inherited from
and
▸ and<T
>(incoming
): ZodIntersection
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
incoming | T |
Returns
ZodIntersection
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, T
>
Inherited from
array
▸ array(): ZodArray
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, "many"
>
Returns
ZodArray
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, "many"
>
Inherited from
brand
▸ brand<B
>(brand?
): ZodBranded
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, B
>
Type parameters
Name | Type |
---|---|
B | extends string | number | symbol |
Parameters
Name | Type |
---|---|
brand? | B |
Returns
ZodBranded
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, B
>
Inherited from
catch
▸ catch(def
): ZodCatch
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Parameters
Name | Type |
---|---|
def | Output |
Returns
ZodCatch
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Inherited from
▸ catch(def
): ZodCatch
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Parameters
Name | Type |
---|---|
def | (ctx : { error : ZodError <any > ; input : Input }) => Output |
Returns
ZodCatch
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Inherited from
catchall
▸ catchall<Index
>(index
): ZodObject
<T
, UnknownKeys
, Index
, objectOutputType
<T
, Index
, UnknownKeys
>, objectInputType
<T
, Index
, UnknownKeys
>>
Type parameters
Name | Type |
---|---|
Index | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
index | Index |
Returns
ZodObject
<T
, UnknownKeys
, Index
, objectOutputType
<T
, Index
, UnknownKeys
>, objectInputType
<T
, Index
, UnknownKeys
>>
deepPartial
▸ deepPartial(): DeepPartial
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Returns
DeepPartial
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Deprecated
default
▸ default(def
): ZodDefault
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Parameters
Name | Type |
---|---|
def | noUndefined <Input > |
Returns
ZodDefault
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Inherited from
▸ default(def
): ZodDefault
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Parameters
Name | Type |
---|---|
def | () => noUndefined <Input > |
Returns
ZodDefault
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Inherited from
describe
▸ describe(description
): this
Parameters
Name | Type |
---|---|
description | string |
Returns
this
Inherited from
extend
▸ extend<Augmentation
>(augmentation
): ZodObject
<extendShape
<T
, Augmentation
>, UnknownKeys
, Catchall
, objectOutputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>, objectInputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>>
Type parameters
Name | Type |
---|---|
Augmentation | extends ZodRawShape |
Parameters
Name | Type |
---|---|
augmentation | Augmentation |
Returns
ZodObject
<extendShape
<T
, Augmentation
>, UnknownKeys
, Catchall
, objectOutputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>, objectInputType
<extendShape
<T
, Augmentation
>, Catchall
, UnknownKeys
>>
isNullable
▸ isNullable(): boolean
Returns
boolean
Inherited from
isOptional
▸ isOptional(): boolean
Returns
boolean
Inherited from
keyof
▸ keyof(): ZodEnum
<CastToStringTuple
<UnionToTuple
<keyof T
, []>>>
Returns
ZodEnum
<CastToStringTuple
<UnionToTuple
<keyof T
, []>>>
merge
▸ merge<Incoming
, Augmentation
>(merging
): ZodObject
<extendShape
<T
, Augmentation
>, Incoming
["_def"
]["unknownKeys"
], Incoming
["_def"
]["catchall"
], objectOutputType
<extendShape
<T
, Augmentation
>, Incoming
["_def"
]["catchall"
], Incoming
["_def"
]["unknownKeys"
]>, objectInputType
<extendShape
<T
, Augmentation
>, Incoming
["_def"
]["catchall"
], Incoming
["_def"
]["unknownKeys"
]>>
Prior to zod@1.0.12 there was a bug in the inferred type of merged objects. Please upgrade if you are experiencing issues.
Type parameters
Name | Type |
---|---|
Incoming | extends AnyZodObject |
Augmentation | extends any |
Parameters
Name | Type |
---|---|
merging | Incoming |
Returns
ZodObject
<extendShape
<T
, Augmentation
>, Incoming
["_def"
]["unknownKeys"
], Incoming
["_def"
]["catchall"
], objectOutputType
<extendShape
<T
, Augmentation
>, Incoming
["_def"
]["catchall"
], Incoming
["_def"
]["unknownKeys"
]>, objectInputType
<extendShape
<T
, Augmentation
>, Incoming
["_def"
]["catchall"
], Incoming
["_def"
]["unknownKeys"
]>>
nullable
▸ nullable(): ZodNullable
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Returns
ZodNullable
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Inherited from
nullish
▸ nullish(): ZodOptional
<ZodNullable
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>>
Returns
ZodOptional
<ZodNullable
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>>
Inherited from
omit
▸ omit<Mask
>(mask
): ZodObject
<Omit
<T
, keyof Mask
>, UnknownKeys
, Catchall
, objectOutputType
<Omit
<T
, keyof Mask
>, Catchall
, UnknownKeys
>, objectInputType
<Omit
<T
, keyof Mask
>, Catchall
, UnknownKeys
>>
Type parameters
Name | Type |
---|---|
Mask | extends Exactly <{ [k in string | number | symbol]?: true }, Mask > |
Parameters
Name | Type |
---|---|
mask | Mask |
Returns
ZodObject
<Omit
<T
, keyof Mask
>, UnknownKeys
, Catchall
, objectOutputType
<Omit
<T
, keyof Mask
>, Catchall
, UnknownKeys
>, objectInputType
<Omit
<T
, keyof Mask
>, Catchall
, UnknownKeys
>>
optional
▸ optional(): ZodOptional
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Returns
ZodOptional
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Inherited from
or
▸ or<T
>(option
): ZodUnion
<[ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, T
]>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
option | T |
Returns
ZodUnion
<[ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, T
]>
Inherited from
parse
▸ parse(data
, params?
): Output
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Output
Inherited from
parseAsync
▸ parseAsync(data
, params?
): Promise
<Output
>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<Output
>
Inherited from
partial
▸ partial(): ZodObject
<{ [k in string | number | symbol]: ZodOptional<T[k]> }, UnknownKeys
, Catchall
, objectOutputType
<{ [k in string | number | symbol]: ZodOptional<T[k]> }, Catchall
, UnknownKeys
>, objectInputType
<{ [k in string | number | symbol]: ZodOptional<T[k]> }, Catchall
, UnknownKeys
>>
Returns
ZodObject
<{ [k in string | number | symbol]: ZodOptional<T[k]> }, UnknownKeys
, Catchall
, objectOutputType
<{ [k in string | number | symbol]: ZodOptional<T[k]> }, Catchall
, UnknownKeys
>, objectInputType
<{ [k in string | number | symbol]: ZodOptional<T[k]> }, Catchall
, UnknownKeys
>>
▸ partial<Mask
>(mask
): ZodObject
<{ [k in string | number | symbol]: k extends keyof T ? { [k in string | number | symbol]: k extends keyof Mask ? ZodOptional<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 ? ZodOptional<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 ? ZodOptional<T[k<k>]> : T[k] }[k<k>] : never }, Catchall
, UnknownKeys
>>
Type parameters
Name | Type |
---|---|
Mask | extends Exactly <{ [k in string | number | symbol]?: true }, Mask > |
Parameters
Name | Type |
---|---|
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<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 ? ZodOptional<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 ? ZodOptional<T[k<k>]> : T[k] }[k<k>] : never }, Catchall
, UnknownKeys
>>
passthrough
▸ passthrough(): ZodObject
<T
, "passthrough"
, Catchall
, objectOutputType
<T
, Catchall
, "passthrough"
>, objectInputType
<T
, Catchall
, "passthrough"
>>
Returns
ZodObject
<T
, "passthrough"
, Catchall
, objectOutputType
<T
, Catchall
, "passthrough"
>, objectInputType
<T
, Catchall
, "passthrough"
>>
pick
▸ pick<Mask
>(mask
): ZodObject
<Pick
<T
, Extract
<keyof T
, keyof Mask
>>, UnknownKeys
, Catchall
, objectOutputType
<Pick
<T
, Extract
<keyof T
, keyof Mask
>>, Catchall
, UnknownKeys
>, objectInputType
<Pick
<T
, Extract
<keyof T
, keyof Mask
>>, Catchall
, UnknownKeys
>>
Type parameters
Name | Type |
---|---|
Mask | extends Exactly <{ [k in string | number | symbol]?: true }, Mask > |
Parameters
Name | Type |
---|---|
mask | Mask |
Returns
ZodObject
<Pick
<T
, Extract
<keyof T
, keyof Mask
>>, UnknownKeys
, Catchall
, objectOutputType
<Pick
<T
, Extract
<keyof T
, keyof Mask
>>, Catchall
, UnknownKeys
>, objectInputType
<Pick
<T
, Extract
<keyof T
, keyof Mask
>>, Catchall
, UnknownKeys
>>
pipe
▸ pipe<T
>(target
): ZodPipeline
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
target | T |
Returns
ZodPipeline
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, T
>
Inherited from
promise
▸ promise(): ZodPromise
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Returns
ZodPromise
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Inherited from
readonly
▸ readonly(): ZodReadonly
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Returns
ZodReadonly
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>>
Inherited from
refine
▸ refine<RefinedOutput
>(check
, message?
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, RefinedOutput
, Input
>
Type parameters
Name |
---|
RefinedOutput |
Parameters
Name | Type |
---|---|
check | (arg : Output ) => arg is RefinedOutput |
message? | string | Partial <Omit <ZodCustomIssue , "code" >> | (arg : Output ) => Partial <Omit <ZodCustomIssue , "code" >> |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, RefinedOutput
, Input
>
Inherited from
▸ refine(check
, message?
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Parameters
Name | Type |
---|---|
check | (arg : Output ) => unknown |
message? | string | Partial <Omit <ZodCustomIssue , "code" >> | (arg : Output ) => Partial <Omit <ZodCustomIssue , "code" >> |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Inherited from
refinement
▸ refinement<RefinedOutput
>(check
, refinementData
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, RefinedOutput
, Input
>
Type parameters
Name |
---|
RefinedOutput |
Parameters
Name | Type |
---|---|
check | (arg : Output ) => arg is RefinedOutput |
refinementData | IssueData | (arg : Output , ctx : RefinementCtx ) => IssueData |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, RefinedOutput
, Input
>
Inherited from
▸ refinement(check
, refinementData
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Parameters
Name | Type |
---|---|
check | (arg : Output ) => boolean |
refinementData | IssueData | (arg : Output , ctx : RefinementCtx ) => IssueData |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Inherited from
required
▸ required(): 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
>>
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
>>
▸ required<Mask
>(mask
): 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
>>
Type parameters
Name | Type |
---|---|
Mask | extends Exactly <{ [k in string | number | symbol]?: true }, Mask > |
Parameters
Name | Type |
---|---|
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<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
>>
safeParse
▸ safeParse(data
, params?
): SafeParseReturnType
<Input
, Output
>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
SafeParseReturnType
<Input
, Output
>
Inherited from
safeParseAsync
▸ safeParseAsync(data
, params?
): Promise
<SafeParseReturnType
<Input
, Output
>>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<SafeParseReturnType
<Input
, Output
>>
Inherited from
setKey
▸ setKey<Key
, Schema
>(key
, schema
): ZodObject
<T
& { [k in string]: Schema }, UnknownKeys
, Catchall
, objectOutputType
<T
& { [k in string]: Schema }, Catchall
, UnknownKeys
>, objectInputType
<T
& { [k in string]: Schema }, Catchall
, UnknownKeys
>>
Type parameters
Name | Type |
---|---|
Key | extends string |
Schema | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
key | Key |
schema | Schema |
Returns
ZodObject
<T
& { [k in string]: Schema }, UnknownKeys
, Catchall
, objectOutputType
<T
& { [k in string]: Schema }, Catchall
, UnknownKeys
>, objectInputType
<T
& { [k in string]: Schema }, Catchall
, UnknownKeys
>>
strict
▸ strict(message?
): ZodObject
<T
, "strict"
, Catchall
, objectOutputType
<T
, Catchall
, "strict"
>, objectInputType
<T
, Catchall
, "strict"
>>
Parameters
Name | Type |
---|---|
message? | ErrMessage |
Returns
ZodObject
<T
, "strict"
, Catchall
, objectOutputType
<T
, Catchall
, "strict"
>, objectInputType
<T
, Catchall
, "strict"
>>
strip
▸ strip(): ZodObject
<T
, "strip"
, Catchall
, objectOutputType
<T
, Catchall
, "strip"
>, objectInputType
<T
, Catchall
, "strip"
>>
Returns
ZodObject
<T
, "strip"
, Catchall
, objectOutputType
<T
, Catchall
, "strip"
>, objectInputType
<T
, Catchall
, "strip"
>>
superRefine
▸ superRefine<RefinedOutput
>(refinement
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, RefinedOutput
, Input
>
Type parameters
Name |
---|
RefinedOutput |
Parameters
Name | Type |
---|---|
refinement | (arg : Output , ctx : RefinementCtx ) => arg is RefinedOutput |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, RefinedOutput
, Input
>
Inherited from
▸ superRefine(refinement
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Parameters
Name | Type |
---|---|
refinement | (arg : Output , ctx : RefinementCtx ) => void |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Inherited from
▸ superRefine(refinement
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Parameters
Name | Type |
---|---|
refinement | (arg : Output , ctx : RefinementCtx ) => Promise <void > |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, Output
, Input
>
Inherited from
transform
▸ transform<NewOut
>(transform
): ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, NewOut
, Input
>
Type parameters
Name |
---|
NewOut |
Parameters
Name | Type |
---|---|
transform | (arg : Output , ctx : RefinementCtx ) => NewOut | Promise <NewOut > |
Returns
ZodEffects
<ZodObject
<T
, UnknownKeys
, Catchall
, Output
, Input
>, NewOut
, Input
>
Inherited from
~validate
▸ ~validate(data
): Result
<Output
> | Promise
<Result
<Output
>>
Parameters
Name | Type |
---|---|
data | unknown |
Returns
Result
<Output
> | Promise
<Result
<Output
>>