v4: The `isPlainObject` util returns false for objects with a nested null prototype · Issue #4573 · colinhacks/zod · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This case occurs when you create an object whose prototype is itself null-prototyped. In this case, defining a record as z.record() will fail with error Invalid input: expected record, received object.
The text was updated successfully, but these errors were encountered:
I'm not necessarily opposed to this, but where are you seeing this happen in the wild? I'm not sure this is worth the bundle size & complexity overheads. If this change isn't motivated by something then it just seems unnecessary to me. Whether this even qualifies as "plain" is up for debate. It's actually quite arcane.
colinhacks
changed the title
v4: The isPlainObject fails on objects with a nested null prototype
v4: The isPlainObject util returns false for objects with a nested null prototype
May 30, 2025
Following up #4270, there is still an unhandled edge case when an object has a nested null prototype.
Example :
This case occurs when you create an object whose prototype is itself null-prototyped. In this case, defining a record as
z.record()
will fail with errorInvalid input: expected record, received object
.The text was updated successfully, but these errors were encountered: