We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
import { object, string, optional, pipe, transform, InferOutput, } from "valibot"; const SchemaA = object({ key: pipe( optional(string()), transform((input) => (input === undefined ? "empty" : input)), ), }); type SchemaAType = InferOutput<typeof SchemaA>; const SchemaB = pipe( object({ key: optional(string()), }), transform((input) => ({ key: input.key === undefined ? "empty" : input.key, })), ); type SchemaBType = InferOutput<typeof SchemaB>;
When defined as above
At 0.42.1, both were like SchemaBTyoe. Is it a specification from v1 or a problem?
The text was updated successfully, but these errors were encountered:
See #1095
Sorry, something went wrong.
Depending on your goal you can define a default value via the second argument of optional or replace optional with undefinedable.
optional
undefinedable
Thank you!
I didn't know about undefinedable. That's helpful.
fabian-hiller
No branches or pull requests
When defined as above
At 0.42.1, both were like SchemaBTyoe.
Is it a specification from v1 or a problem?
The text was updated successfully, but these errors were encountered: