When is the schema validation ACTUALLY happening?
I encountered this issue - I have an age, that should be a number after submitting. However, to get it, I need to use TextField. Because of Typescript errors, I need to cast it as number (I know this isn't the best approach, but hear me out pls
)
When I hit submit, the age value is run through the schema (which happens and logged
Isn't this weird? In zod, when I run values through a schema, I can count on them being the correct type, but here it seems it doesn't work that way. It seems like the result of the parsing is thrown away and the original values are returned in the
When I hit submit, the age value is run through the schema (which happens and logged
REFINED VALUE is of type number). However, when I log the the value and its type in onSubmit handler, it is a string.Isn't this weird? In zod, when I run values through a schema, I can count on them being the correct type, but here it seems it doesn't work that way. It seems like the result of the parsing is thrown away and the original values are returned in the
onSubmit handler. Is this a bug or a required behavior?