We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I updated valibot and discovered that after #878 the following pattern does not convert null to undefined anymore.
null
undefined
const schema = v.nullish(v.string(), undefined); const result = v.parse(schema, null); console.log(result); // null
Types also reflect that change, what is recommended way of doing this conversion now?
The text was updated successfully, but these errors were encountered:
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.
Sorry, something went wrong.
Thank you for a quick reply, fix you provided does work for me
fabian-hiller
No branches or pull requests
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?
The text was updated successfully, but these errors were encountered: