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
In zod we can do this:
type Test { field1?: string, field2?: string, } const TestSchema: z.ZodType<Test> = z.object({ field1: z.string().optional(), field2: z.string().optional(), });
Is anything similar in valibot? Thanks for the awsome library!
The text was updated successfully, but these errors were encountered:
Yes, please try out BaseSchema:
BaseSchema
import * as v from 'valibot'; type Test { field1?: string, field2?: string, } const TestSchema: v.BaseSchema<Test> = v.object({ field1: v.optional(v.string()), field2: v.optional(v.string()), });
Sorry, something went wrong.
Hint: Sometimes satisfies is better to not lose type safety for specific object related information:
satisfies
import * as v from 'valibot'; type Test { field1?: string, field2?: string, } const TestSchema = v.object({ field1: v.optional(v.string()), field2: v.optional(v.string()), }) satisfies v.BaseSchema<Test>;
fabian-hiller
No branches or pull requests
In zod we can do this:
Is anything similar in valibot? Thanks for the awsome library!
The text was updated successfully, but these errors were encountered: