Skip to content

the reason why validator middleware return errors when z.number() #1704

Answered by yusukebe
PorcoRosso85 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @PorcoRosso85,

If you're validating a form, the values will always be of type string because that's how they're defined in TypeScript. Btw, if you set the input as json, the values can be of types number or boolean.

For converting a string to number and validating it, you might find this comment helpful:

honojs/middleware#91 (comment)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PorcoRosso85
Comment options

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