Skip to content

string type narrowing #381

Answered by prescience-data
meadowsys asked this question in Q&A
Discussion options

You must be logged in to vote

Is there a reason for not using enum ( which is what this is for )?

z.object({
  category: z.enum(["block", "sound", "lang", "misc"]).default("block")
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@meadowsys
Comment options

@colinhacks
Comment options

Answer selected by meadowsys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants