title: Core.z. Zod Native Enum
A2A Node SDK - v0.1.0 / Modules / Core / z / ZodNativeEnum
Class: ZodNativeEnum<T>
Type parameters
Name | Type |
---|---|
T | extends EnumLike |
Hierarchy
-
ZodType
<T
[keyofT
],ZodNativeEnumDef
<T
>,T
[keyofT
]>↳
ZodNativeEnum
Table of contents
Constructors
Properties
Accessors
Methods
- _getOrReturnCtx
- _getType
- _parse
- _parseAsync
- _parseSync
- _processInputParams
- _refinement
- and
- array
- brand
- catch
- default
- describe
- isNullable
- isOptional
- nullable
- nullish
- optional
- or
- parse
- parseAsync
- pipe
- promise
- readonly
- refine
- refinement
- safeParse
- safeParseAsync
- superRefine
- transform
- ~validate
Constructors
constructor
• new ZodNativeEnum<T
>(def
): ZodNativeEnum
<T
>
Type parameters
Name | Type |
---|---|
T | extends EnumLike |
Parameters
Name | Type |
---|---|
def | ZodNativeEnumDef <T > |
Returns
Inherited from
Properties
_def
• Readonly
_def: ZodNativeEnumDef
<T
>
Inherited from
_input
• Readonly
_input: T
[keyof T
]
Inherited from
_output
• Readonly
_output: T
[keyof T
]
Inherited from
_type
• Readonly
_type: T
[keyof T
]
Inherited from
create
▪ Static
create: <Elements>(values
: Elements
, params?
: RawCreateParams
) => ZodNativeEnum
<Elements
>
Type declaration
▸ <Elements
>(values
, params?
): ZodNativeEnum
<Elements
>
Type parameters
Name | Type |
---|---|
Elements | extends EnumLike |
Parameters
Name | Type |
---|---|
values | Elements |
params? | RawCreateParams |
Returns
ZodNativeEnum
<Elements
>
spa
• spa: (data
: unknown
, params?
: InexactPartial
<ParseParams
>) => Promise
<SafeParseReturnType
<T
[keyof T
], T
[keyof T
]>>
Alias of safeParseAsync
Type declaration
▸ (data
, params?
): Promise
<SafeParseReturnType
<T
[keyof T
], T
[keyof T
]>>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<SafeParseReturnType
<T
[keyof T
], T
[keyof T
]>>
Inherited from
~standard
• ~standard: Props
<T
[keyof T
], T
[keyof T
]>
Inherited from
Accessors
description
• get
description(): undefined
| string
Returns
undefined
| string
Inherited from
ZodType.description
enum
• get
enum(): T
Returns
T
Methods
_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
<T
[keyof T
]>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
ParseReturnType
<T
[keyof T
]>
Overrides
_parseAsync
▸ _parseAsync(input
): AsyncParseReturnType
<T
[keyof T
]>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
AsyncParseReturnType
<T
[keyof T
]>
Inherited from
_parseSync
▸ _parseSync(input
): SyncParseReturnType
<T
[keyof T
]>
Parameters
Name | Type |
---|---|
input | ParseInput |
Returns
SyncParseReturnType
<T
[keyof T
]>
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
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Parameters
Name | Type |
---|---|
refinement | (arg : T [keyof T ], ctx : RefinementCtx ) => any |
Returns
ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Inherited from
and
▸ and<T
>(incoming
): ZodIntersection
<ZodNativeEnum
<T
>, T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
incoming | T |
Returns
ZodIntersection
<ZodNativeEnum
<T
>, T
>
Inherited from
array
▸ array(): ZodArray
<ZodNativeEnum
<T
>, "many"
>
Returns
ZodArray
<ZodNativeEnum
<T
>, "many"
>
Inherited from
brand
▸ brand<B
>(brand?
): ZodBranded
<ZodNativeEnum
<T
>, B
>
Type parameters
Name | Type |
---|---|
B | extends string | number | symbol |
Parameters
Name | Type |
---|---|
brand? | B |
Returns
ZodBranded
<ZodNativeEnum
<T
>, B
>
Inherited from
catch
▸ catch(def
): ZodCatch
<ZodNativeEnum
<T
>>
Parameters
Name | Type |
---|---|
def | T [keyof T ] |
Returns
Inherited from
▸ catch(def
): ZodCatch
<ZodNativeEnum
<T
>>
Parameters
Name | Type |
---|---|
def | (ctx : { error : ZodError <any > ; input : T [keyof T ] }) => T [keyof T ] |
Returns
Inherited from
default
▸ default(def
): ZodDefault
<ZodNativeEnum
<T
>>
Parameters
Name | Type |
---|---|
def | noUndefined <T [keyof T ]> |
Returns
Inherited from
▸ default(def
): ZodDefault
<ZodNativeEnum
<T
>>
Parameters
Name | Type |
---|---|
def | () => noUndefined <T [keyof T ]> |
Returns
Inherited from
describe
▸ describe(description
): this
Parameters
Name | Type |
---|---|
description | string |
Returns
this
Inherited from
isNullable
▸ isNullable(): boolean
Returns
boolean
Inherited from
isOptional
▸ isOptional(): boolean
Returns
boolean
Inherited from
nullable
▸ nullable(): ZodNullable
<ZodNativeEnum
<T
>>
Returns
Inherited from
nullish
▸ nullish(): ZodOptional
<ZodNullable
<ZodNativeEnum
<T
>>>
Returns
ZodOptional
<ZodNullable
<ZodNativeEnum
<T
>>>
Inherited from
optional
▸ optional(): ZodOptional
<ZodNativeEnum
<T
>>
Returns
Inherited from
or
▸ or<T
>(option
): ZodUnion
<[ZodNativeEnum
<T
>, T
]>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
option | T |
Returns
ZodUnion
<[ZodNativeEnum
<T
>, T
]>
Inherited from
parse
▸ parse(data
, params?
): T
[keyof T
]
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
T
[keyof T
]
Inherited from
parseAsync
▸ parseAsync(data
, params?
): Promise
<T
[keyof T
]>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<T
[keyof T
]>
Inherited from
pipe
▸ pipe<T
>(target
): ZodPipeline
<ZodNativeEnum
<T
>, T
>
Type parameters
Name | Type |
---|---|
T | extends ZodTypeAny |
Parameters
Name | Type |
---|---|
target | T |
Returns
ZodPipeline
<ZodNativeEnum
<T
>, T
>
Inherited from
promise
▸ promise(): ZodPromise
<ZodNativeEnum
<T
>>
Returns
Inherited from
readonly
▸ readonly(): ZodReadonly
<ZodNativeEnum
<T
>>
Returns
Inherited from
refine
▸ refine<RefinedOutput
>(check
, message?
): ZodEffects
<ZodNativeEnum
<T
>, RefinedOutput
, T
[keyof T
]>
Type parameters
Name | Type |
---|---|
RefinedOutput | extends string | number |
Parameters
Name | Type |
---|---|
check | (arg : T [keyof T ]) => arg is RefinedOutput |
message? | string | Partial <Omit <ZodCustomIssue , "code" >> | (arg : T [keyof T ]) => Partial <Omit <ZodCustomIssue , "code" >> |
Returns
ZodEffects
<ZodNativeEnum
<T
>, RefinedOutput
, T
[keyof T
]>
Inherited from
▸ refine(check
, message?
): ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Parameters
Name | Type |
---|---|
check | (arg : T [keyof T ]) => unknown |
message? | string | Partial <Omit <ZodCustomIssue , "code" >> | (arg : T [keyof T ]) => Partial <Omit <ZodCustomIssue , "code" >> |
Returns
ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Inherited from
refinement
▸ refinement<RefinedOutput
>(check
, refinementData
): ZodEffects
<ZodNativeEnum
<T
>, RefinedOutput
, T
[keyof T
]>
Type parameters
Name | Type |
---|---|
RefinedOutput | extends string | number |
Parameters
Name | Type |
---|---|
check | (arg : T [keyof T ]) => arg is RefinedOutput |
refinementData | IssueData | (arg : T [keyof T ], ctx : RefinementCtx ) => IssueData |
Returns
ZodEffects
<ZodNativeEnum
<T
>, RefinedOutput
, T
[keyof T
]>
Inherited from
▸ refinement(check
, refinementData
): ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Parameters
Name | Type |
---|---|
check | (arg : T [keyof T ]) => boolean |
refinementData | IssueData | (arg : T [keyof T ], ctx : RefinementCtx ) => IssueData |
Returns
ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Inherited from
safeParse
▸ safeParse(data
, params?
): SafeParseReturnType
<T
[keyof T
], T
[keyof T
]>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
SafeParseReturnType
<T
[keyof T
], T
[keyof T
]>
Inherited from
safeParseAsync
▸ safeParseAsync(data
, params?
): Promise
<SafeParseReturnType
<T
[keyof T
], T
[keyof T
]>>
Parameters
Name | Type |
---|---|
data | unknown |
params? | InexactPartial <ParseParams > |
Returns
Promise
<SafeParseReturnType
<T
[keyof T
], T
[keyof T
]>>
Inherited from
superRefine
▸ superRefine<RefinedOutput
>(refinement
): ZodEffects
<ZodNativeEnum
<T
>, RefinedOutput
, T
[keyof T
]>
Type parameters
Name | Type |
---|---|
RefinedOutput | extends string | number |
Parameters
Name | Type |
---|---|
refinement | (arg : T [keyof T ], ctx : RefinementCtx ) => arg is RefinedOutput |
Returns
ZodEffects
<ZodNativeEnum
<T
>, RefinedOutput
, T
[keyof T
]>
Inherited from
▸ superRefine(refinement
): ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Parameters
Name | Type |
---|---|
refinement | (arg : T [keyof T ], ctx : RefinementCtx ) => void |
Returns
ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Inherited from
▸ superRefine(refinement
): ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Parameters
Name | Type |
---|---|
refinement | (arg : T [keyof T ], ctx : RefinementCtx ) => Promise <void > |
Returns
ZodEffects
<ZodNativeEnum
<T
>, T
[keyof T
], T
[keyof T
]>
Inherited from
transform
▸ transform<NewOut
>(transform
): ZodEffects
<ZodNativeEnum
<T
>, NewOut
, T
[keyof T
]>
Type parameters
Name |
---|
NewOut |
Parameters
Name | Type |
---|---|
transform | (arg : T [keyof T ], ctx : RefinementCtx ) => NewOut | Promise <NewOut > |
Returns
ZodEffects
<ZodNativeEnum
<T
>, NewOut
, T
[keyof T
]>
Inherited from
~validate
▸ ~validate(data
): Result
<T
[keyof T
]> | Promise
<Result
<T
[keyof T
]>>
Parameters
Name | Type |
---|---|
data | unknown |
Returns
Result
<T
[keyof T
]> | Promise
<Result
<T
[keyof T
]>>