yup.number().nullable() does not allow `null` value
See original GitHub issueyup.number().nullable() does not work for me in case of {field: {label: 'Some', value: null }}:
yup.object().shape({
// ...
field: yup.object().shape({
label: yup.string(),
value: yup.number().nullable()
}),
});
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How can I make a yup number accept nullable values?
Hi @xdumaine, thanks for your response. However, when the field is left as empty, the value that it returns is NaN instead of...
Read more >Form schema
Form component renders a value to be updated and validated by child Fields. Forms can be thought of as <input/> s for complex...
Read more >Formik Yup validation: string or null / boolean - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >Yup | Best of JS
Yup is a schema builder for runtime value parsing and validation. ... When nullable() is set null is considered a valid value of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yes we should update the docs!
the linked issue has a solution for that
What if we want to require a field to exist, and that it can take on null.
nullable().required()would make sense. How would you achieve that at the moment?