Closed akrynski-1 closed 2 weeks ago
Hey, sorry for producing a bug in your code. Here is a fix:
const schema = v.nullish(v.string(), () => undefined);
const result = v.parse(schema, null);
console.log(result); // undefined
Due to some TypeScript issues, undefined
is now treated as having no default. The workaround is to pass a function that returns undefined
.
Thank you for a quick reply, fix you provided does work for me
I updated valibot and discovered that after #878 the following pattern does not convert
null
toundefined
anymore.Types also reflect that change, what is recommended way of doing this conversion now?