nullPrototypeAssertion:AssertionStandardSchemaSync< readonly[readonly["to have a null prototype","to be a dictionary"]], ZodCustom<Record<PropertyKey,unknown>,Record<PropertyKey,unknown>>, never, > = ...
Asserts that an object has a null prototype (i.e.,
Object.getPrototypeOf(obj) === null).
This is useful for checking if an object was created with
Object.create(null) or similar patterns that create truly "dictionary-like"
objects without any inherited properties.
Example
constobj=Object.create(null); expect(obj,'to have a null prototype');// ✓ passes
constregular={}; expect(regular,'to have a null prototype');// ✗ fails - has Object.prototype
Asserts that an object has a null prototype (i.e.,
Object.getPrototypeOf(obj) === null).This is useful for checking if an object was created with
Object.create(null)or similar patterns that create truly "dictionary-like" objects without any inherited properties.