zod icon indicating copy to clipboard operation
zod copied to clipboard

v4: The `isPlainObject` fails on objects without a prototype

Open noahmayr opened this issue 8 months ago • 0 comments

While it makes sense that objects that are actually instances of something other than Object to not be treated as plain objects, objects can also have no prototype at all (Object.create(null)) which turns out to be something prosemirror likes to use. With v3 this parsed fine as z.record(z.string(), z.any()) and now fails with Invalid input: expected record, received object.

It'd be great if the isPlainObject check could be expanded to also accept objects without any prototype at all.

noahmayr avatar Apr 23 '25 20:04 noahmayr