-
-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
Instead of exporting schemas of a specific type. Let the type be inferred and validated with satisfies.
Would it be possible?
// Example taken from README
export function ExampleInputSchema(): z.ZodSchema<ExampleInput> {
return z.object({
email: z.string().min(50).email(),
message: z.string().regex(/^Hello/, "message")
})
}
export function ExampleInputSchema() {
return z.object({
email: z.string().min(50).email(),
message: z.string().regex(/^Hello/, "message")
}) satisfies z.ZodSchema<ExampleInput>
}
// might be easier with const
export const ExampleInputSchema = z.object({
email: z.string().min(50).email(),
message: z.string().regex(/^Hello/, "message")} satisfies z.ZodSchema<ExampleInput>Metadata
Metadata
Assignees
Labels
No labels