This shouldn't fail, and it didn't prior to 0.28.4:
const schema = object({
name: string()
}).nullable().noUnknown();
schema.validate(null) // this throws "Cannot convert undefined or null to object"
I'm guessing it has something to do with https://github.com/jquense/yup/pull/579
To Reproduce
See error on 0.28.4: https://runkit.com/icflorescu/5ea1f46ebc48c6001a449316
Expected behavior
See it working correctly on 0.28.3: https://runkit.com/icflorescu/5ea1f8227abc65001a36be1f
Platform (please complete the following information):
It is related to #579.
https://github.com/jquense/yup/blob/16efe88a8953db60438f77f43bd5bf614079803d/src/object.js#L243
const unknownKeys = unknown(this.schema, value) shouldn't happen before testing for value == null
Do you want me to do a PR?
sure!
Can you please publish a new version on npm? Thanks a lot!
+1 for a release
Anything I can help with to speed up releasing the new version on npm?
Any idea when this will be released?
It was released 12 days ago, AFAIK.
@BenGale Why, did you encounter the same problem? This should be gone for yup ^0.28.5...
No sorry, all good now. I must have missed the release.
Most helpful comment
Can you please publish a new version on npm? Thanks a lot!