Priority of [ typeError vs required ]
See original GitHub issueDescribe the bug
// my scheme
yup
.number()
.typeError('this is NaN')
.positive('only positive')
.integer('only int')
.required('plz input the value'), // never comes here...
when this scheme meets an empty string( like ""
), I expected show error messege of required, which is plz input the value
.
But actual happen is that the error messege is this is NaN
(which is typeError
scheme)
In this case, required
sechem never comes.
I want to show 'plz input the value'
message when value is empty.
Thx in advance 😃
Platform (please complete the following information):
- Browser [chrome]
- Version [
"yup": "^0.29.1"
]
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Appending a self constructed class in priority que gives ...
Herein, I am getting an error in while loop, after a few operations it fails to use the method q.get(), or q.put(). For...
Read more >8. Errors and Exceptions — Python 3.11.1 documentation
The TypeError raised by dividing two strings is not handled by the except clause and therefore re-raised after the finally clause has been...
Read more >Adding a priority value to tasks in a Flexible Job Shop Problem
Minimize(V*makespan+Wi*job_ends)? With what I've done now, I'm getting the following error: 'TypeError: Not an number: makespan'.
Read more >Priority Queue in Python - blogboard.io
Priority queue is a data structure similar to a regular queue, but where elements have priorities assigned. Python comes with a built-in ...
Read more >CSSStyleDeclaration.setProperty() - Web APIs | MDN
Thrown if the property or declaration block is read only. Alternative usage. If priority can be omitted, JavaScript has a special simpler syntax ......
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 FreeTop 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
Top GitHub Comments
The
transform
function also accepts a secondary value, originalValue. If you want to have empty values as valid, you can use:Or if you want to distinguish invalid (type error) values from required values use:
For any of those confused like me, don’t use
.default(undefined)
usetransform
as described in #634@jquense This would be really helpful to put into documentation about
number().required()
. I would expect it to transform like this under the hood for.required()
because otherwise it’s essentially ignored/overruled by thetypeError
.