Why forcing empty strings to be undefined when validating via validationSchema? #3574
Unanswered
velosipedist
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Any empty string is forced to be undefined before starting Yup validation under the hood:
This means, I cannot be sure that whatever of the values that typed as a string could contain a string. This side-effect is not reflected in typing, so while I am validating something with
yup.test
, I have to manully type the incoming value like this:Wouldn't that make sense to either remove the
undefined
forcing or add this kind of type wrapping on test callbacks?Beta Was this translation helpful? Give feedback.
All reactions