the reason why validator middleware return errors when z.number() #1704
Answered
by
yusukebe
PorcoRosso85
asked this question in
Q&A
-
Hi.
Is there the way to use validation for any types instead of string? |
Beta Was this translation helpful? Give feedback.
Answered by
yusukebe
Nov 16, 2023
Replies: 1 comment 1 reply
-
Hi @PorcoRosso85, If you're validating a For converting a string to |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
PorcoRosso85
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @PorcoRosso85,
If you're validating a
form
, the values will always be of typestring
because that's how they're defined in TypeScript. Btw, if you set the input asjson
, the values can be of typesnumber
orboolean
.For converting a string to
number
and validating it, you might find this comment helpful:honojs/middleware#91 (comment)