jquense / yup

Dead simple Object schema validation
MIT License
22.95k stars 935 forks source link

should all `nonNullable` receive a `msg?: Message` property? #2069

Closed csantos1113 closed 11 months ago

csantos1113 commented 1 year ago

I would like to confirm if all .nonNullable() methods should receive a message or not as I see some methods allowing that to be configured but not others

This methods allow msg prop in nonNullable

This methods do not allow msg prop in nonNullable

To Reproduce

https://codesandbox.io/s/yup1-0-2-non-nullable-4dy2rc?file=/src/index.ts

Expected behavior

Not really sure what is the expected behavior. I'd have expected that all types can be combined with nonNullable(), and that if I use .nonNullable() I can configure the message.

Platform (please complete the following information):

sadik-malik commented 1 year ago

I was trying to use yup.object().nonNullable() but can't pass the customized message.

For i18n purpose, allowing developers to pass custom message in nonNullable would be helpful.

Edit:

Turns out, I can pass customized message to yup.object().nonNullable() but it's just the types which are giving error in typescript.