zod-fast-check
zod-fast-check copied to clipboard
ZodFastCheck().outputOf(z.record(z.number(), z.number())) only builds empty records
This test passes:
it('only builds empty records', () => {
fc.assert(
fc.property(
ZodFastCheck().outputOf(z.record(z.number(), z.number())),
(xs) => {
assert(Object.keys(xs).length === 0);
},
),
);
});
But it would be great if it failed.
Changing the zod schema to z.record(z.number()) (i.e., not supplying a schema for the keys) produces the expected behavior - the resulting record may have more than zero properties - so I suppose the issue has to do with how zod records with custom key schemas are handled.