Open
Description
What version of Elysia is running?
1.3.4
What platform is your computer?
Linux 6.12.29 x86_64
What steps can reproduce the bug?
const type = t.Object({
foo: t.Optional(t.String()),
});
console.log(createMirror(type, {})({})); // prints { foo: undefined }
console.log(Value.Clean(type, {})); // prints {} - an empty object
What is the expected behavior?
Optional fields don't get included at all in the output
What do you see instead?
Optional fields are included as undefined
Additional information
This is not a problem unless you try to add minProperties or maxProperties to an object, see elysiajs/elysia#1205
With Value.Clean no undefined properties get created, so min/maxPeroperties work correctly. With createMirror optional properties appear as undefined, which breaks compatibility with min/maxProperties
Have you try removing the node_modules
and bun.lockb
and try again yet?
doesn't matter