Preparing search index...
The search index is not available
Genkit JS API reference
Genkit JS API reference
genkit
/
z
ZodLiteral
Class ZodLiteral<T>
Type Parameters
T
Hierarchy (
View Summary
)
ZodType
<
T
,
ZodLiteralDef
<
T
>
,
T
>
ZodLiteral
Index
Constructors
constructor
Properties
_def
_input
_output
_type
spa
create
Accessors
description
value
Methods
_get
Or
Return
Ctx
_get
Type
_parse
_parse
Async
_parse
Sync
_process
Input
Params
_refinement
and
array
brand
catch
default
describe
is
Nullable
is
Optional
nullable
nullish
optional
or
parse
parse
Async
pipe
promise
readonly
refine
refinement
safe
Parse
safe
Parse
Async
super
Refine
transform
Constructors
constructor
new
ZodLiteral
<
T
>
(
def
:
ZodLiteralDef
<
T
>
)
:
ZodLiteral
<
T
>
Type Parameters
T
Parameters
def
:
ZodLiteralDef
<
T
>
Returns
ZodLiteral
<
T
>
Properties
Readonly
_def
_def
:
ZodLiteralDef
<
T
>
Readonly
_input
_input
:
T
Readonly
_output
_output
:
T
Readonly
_type
_type
:
T
spa
spa
:
(
data
:
unknown
,
params
?:
Partial
<
ParseParams
>
,
)
=>
Promise
<
SafeParseReturnType
<
T
,
T
>
>
Alias of safeParseAsync
Static
create
create
:
<
T_1
extends
Primitive
>
(
value
:
T_1
,
params
?:
RawCreateParams
,
)
=>
ZodLiteral
<
T_1
>
Accessors
description
get
description
()
:
undefined
|
string
Returns
undefined
|
string
value
get
value
()
:
T
Returns
T
Methods
_get
Or
Return
Ctx
_getOrReturnCtx
(
input
:
ParseInput
,
ctx
?:
ParseContext
)
:
ParseContext
Parameters
input
:
ParseInput
Optional
ctx
:
ParseContext
Returns
ParseContext
_get
Type
_getType
(
input
:
ParseInput
)
:
string
Parameters
input
:
ParseInput
Returns
string
_parse
_parse
(
input
:
ParseInput
)
:
ParseReturnType
<
T
>
Parameters
input
:
ParseInput
Returns
ParseReturnType
<
T
>
_parse
Async
_parseAsync
(
input
:
ParseInput
)
:
AsyncParseReturnType
<
T
>
Parameters
input
:
ParseInput
Returns
AsyncParseReturnType
<
T
>
_parse
Sync
_parseSync
(
input
:
ParseInput
)
:
SyncParseReturnType
<
T
>
Parameters
input
:
ParseInput
Returns
SyncParseReturnType
<
T
>
_process
Input
Params
_processInputParams
(
input
:
ParseInput
,
)
:
{
ctx
:
ParseContext
;
status
:
ParseStatus
}
Parameters
input
:
ParseInput
Returns
{
ctx
:
ParseContext
;
status
:
ParseStatus
}
_refinement
_refinement
(
refinement
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
any
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
Parameters
refinement
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
any
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
and
and
<
T
extends
ZodType
<
any
,
any
,
any
,
T
>
>
(
incoming
:
T
,
)
:
ZodIntersection
<
ZodLiteral
<
T
>
,
T
>
Type Parameters
T
extends
ZodType
<
any
,
any
,
any
,
T
>
Parameters
incoming
:
T
Returns
ZodIntersection
<
ZodLiteral
<
T
>
,
T
>
array
array
()
:
ZodArray
<
ZodLiteral
<
T
>
,
"many"
>
Returns
ZodArray
<
ZodLiteral
<
T
>
,
"many"
>
brand
brand
<
B
extends
string
|
number
|
symbol
>
(
brand
?:
B
,
)
:
ZodBranded
<
ZodLiteral
<
T
>
,
B
>
Type Parameters
B
extends
string
|
number
|
symbol
Parameters
Optional
brand
:
B
Returns
ZodBranded
<
ZodLiteral
<
T
>
,
B
>
catch
catch
(
def
:
T
)
:
ZodCatch
<
ZodLiteral
<
T
>
>
Parameters
def
:
T
Returns
ZodCatch
<
ZodLiteral
<
T
>
>
catch
(
def
:
(
ctx
:
{
error
:
ZodError
<
any
>
;
input
:
T
}
)
=>
T
,
)
:
ZodCatch
<
ZodLiteral
<
T
>
>
Parameters
def
:
(
ctx
:
{
error
:
ZodError
<
any
>
;
input
:
T
}
)
=>
T
Returns
ZodCatch
<
ZodLiteral
<
T
>
>
default
default
(
def
:
noUndefined
<
T
>
)
:
ZodDefault
<
ZodLiteral
<
T
>
>
Parameters
def
:
noUndefined
<
T
>
Returns
ZodDefault
<
ZodLiteral
<
T
>
>
default
(
def
:
()
=>
noUndefined
<
T
>
)
:
ZodDefault
<
ZodLiteral
<
T
>
>
Parameters
def
:
()
=>
noUndefined
<
T
>
Returns
ZodDefault
<
ZodLiteral
<
T
>
>
describe
describe
(
description
:
string
)
:
this
Parameters
description
:
string
Returns
this
is
Nullable
isNullable
()
:
boolean
Returns
boolean
is
Optional
isOptional
()
:
boolean
Returns
boolean
nullable
nullable
()
:
ZodNullable
<
ZodLiteral
<
T
>
>
Returns
ZodNullable
<
ZodLiteral
<
T
>
>
nullish
nullish
()
:
ZodOptional
<
ZodNullable
<
ZodLiteral
<
T
>
>
>
Returns
ZodOptional
<
ZodNullable
<
ZodLiteral
<
T
>
>
>
optional
optional
()
:
ZodOptional
<
ZodLiteral
<
T
>
>
Returns
ZodOptional
<
ZodLiteral
<
T
>
>
or
or
<
T
extends
ZodType
<
any
,
any
,
any
,
T
>
>
(
option
:
T
)
:
ZodUnion
<
[
ZodLiteral
<
T
>
,
T
]
>
Type Parameters
T
extends
ZodType
<
any
,
any
,
any
,
T
>
Parameters
option
:
T
Returns
ZodUnion
<
[
ZodLiteral
<
T
>
,
T
]
>
parse
parse
(
data
:
unknown
,
params
?:
Partial
<
ParseParams
>
)
:
T
Parameters
data
:
unknown
Optional
params
:
Partial
<
ParseParams
>
Returns
T
parse
Async
parseAsync
(
data
:
unknown
,
params
?:
Partial
<
ParseParams
>
)
:
Promise
<
T
>
Parameters
data
:
unknown
Optional
params
:
Partial
<
ParseParams
>
Returns
Promise
<
T
>
pipe
pipe
<
T
extends
ZodType
<
any
,
any
,
any
,
T
>
>
(
target
:
T
,
)
:
ZodPipeline
<
ZodLiteral
<
T
>
,
T
>
Type Parameters
T
extends
ZodType
<
any
,
any
,
any
,
T
>
Parameters
target
:
T
Returns
ZodPipeline
<
ZodLiteral
<
T
>
,
T
>
promise
promise
()
:
ZodPromise
<
ZodLiteral
<
T
>
>
Returns
ZodPromise
<
ZodLiteral
<
T
>
>
readonly
readonly
()
:
ZodReadonly
<
ZodLiteral
<
T
>
>
Returns
ZodReadonly
<
ZodLiteral
<
T
>
>
refine
refine
<
RefinedOutput
>
(
check
:
(
arg
:
T
)
=>
arg
is
RefinedOutput
,
message
?:
|
string
|
Partial
<
Omit
<
ZodCustomIssue
,
"code"
>
>
|
(
arg
:
T
)
=>
Partial
<
Omit
<
ZodCustomIssue
,
"code"
>
>
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
RefinedOutput
,
T
>
Type Parameters
RefinedOutput
Parameters
check
:
(
arg
:
T
)
=>
arg
is
RefinedOutput
Optional
message
:
|
string
|
Partial
<
Omit
<
ZodCustomIssue
,
"code"
>
>
|
(
arg
:
T
)
=>
Partial
<
Omit
<
ZodCustomIssue
,
"code"
>
>
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
RefinedOutput
,
T
>
refine
(
check
:
(
arg
:
T
)
=>
unknown
,
message
?:
|
string
|
Partial
<
Omit
<
ZodCustomIssue
,
"code"
>
>
|
(
arg
:
T
)
=>
Partial
<
Omit
<
ZodCustomIssue
,
"code"
>
>
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
Parameters
check
:
(
arg
:
T
)
=>
unknown
Optional
message
:
|
string
|
Partial
<
Omit
<
ZodCustomIssue
,
"code"
>
>
|
(
arg
:
T
)
=>
Partial
<
Omit
<
ZodCustomIssue
,
"code"
>
>
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
refinement
refinement
<
RefinedOutput
>
(
check
:
(
arg
:
T
)
=>
arg
is
RefinedOutput
,
refinementData
:
IssueData
|
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
IssueData
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
RefinedOutput
,
T
>
Type Parameters
RefinedOutput
Parameters
check
:
(
arg
:
T
)
=>
arg
is
RefinedOutput
refinementData
:
IssueData
|
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
IssueData
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
RefinedOutput
,
T
>
refinement
(
check
:
(
arg
:
T
)
=>
boolean
,
refinementData
:
IssueData
|
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
IssueData
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
Parameters
check
:
(
arg
:
T
)
=>
boolean
refinementData
:
IssueData
|
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
IssueData
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
safe
Parse
safeParse
(
data
:
unknown
,
params
?:
Partial
<
ParseParams
>
,
)
:
SafeParseReturnType
<
T
,
T
>
Parameters
data
:
unknown
Optional
params
:
Partial
<
ParseParams
>
Returns
SafeParseReturnType
<
T
,
T
>
safe
Parse
Async
safeParseAsync
(
data
:
unknown
,
params
?:
Partial
<
ParseParams
>
,
)
:
Promise
<
SafeParseReturnType
<
T
,
T
>
>
Parameters
data
:
unknown
Optional
params
:
Partial
<
ParseParams
>
Returns
Promise
<
SafeParseReturnType
<
T
,
T
>
>
super
Refine
superRefine
<
RefinedOutput
>
(
refinement
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
arg
is
RefinedOutput
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
RefinedOutput
,
T
>
Type Parameters
RefinedOutput
Parameters
refinement
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
arg
is
RefinedOutput
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
RefinedOutput
,
T
>
superRefine
(
refinement
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
void
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
Parameters
refinement
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
void
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
superRefine
(
refinement
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
Promise
<
void
>
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
Parameters
refinement
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
Promise
<
void
>
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
T
,
T
>
transform
transform
<
NewOut
>
(
transform
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
NewOut
|
Promise
<
NewOut
>
,
)
:
ZodEffects
<
ZodLiteral
<
T
>
,
NewOut
,
T
>
Type Parameters
NewOut
Parameters
transform
:
(
arg
:
T
,
ctx
:
RefinementCtx
)
=>
NewOut
|
Promise
<
NewOut
>
Returns
ZodEffects
<
ZodLiteral
<
T
>
,
NewOut
,
T
>
Settings
Member Visibility
Protected
Inherited
External
Theme
OS
Light
Dark
On This Page
Constructors
constructor
Properties
_def
_input
_output
_type
spa
create
Accessors
description
value
Methods
_get
Or
Return
Ctx
_get
Type
_parse
_parse
Async
_parse
Sync
_process
Input
Params
_refinement
and
array
brand
catch
default
describe
is
Nullable
is
Optional
nullable
nullish
optional
or
parse
parse
Async
pipe
promise
readonly
refine
refinement
safe
Parse
safe
Parse
Async
super
Refine
transform
Genkit JS API reference
Loading...
Alias of safeParseAsync