Replies: 1 comment 3 replies
-
I am silly, there is |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to swap the primitive zod type from one to another?
Background
HTML
<input />
-fields are alwaysstring
but in my backend, I want to coerce them into other types.Example
I would like to do something like:
Added complexity:
.optional()
and inputnumber
being okI'd ideally like something like this to work
Where:
optionalNumeric['_input']
=number | string | undefined
optionalNumeric['_output']
=number | undefined
reqNumeric['_input']
=number | string
reqNumeric['_output']
=number
Beta Was this translation helpful? Give feedback.
All reactions