Is it possible to pass a zod schema as a prop?
I have this
what is the proper way to type the schema prop on the receiving end?
Solution:Jump to solution
owo7 if you want to accept any zod schema then you could do something like
```
import type { ZodSchema } from "zod"
type ComponentProps<TSchema extends ZodSchema> = {...
5 Replies
Solution
owo7 if you want to accept any zod schema then you could do something like
But if want to accept a specific schema
Thank you that helps.
np : D
The zod docs covers this,
https://zod.dev/
Scroll down until you get to the z.infer. There’s another section that goes a bit more in depth, z.infer, z.input & z.output
GitHub
TypeScript-first schema validation with static type inference
TypeScript-first schema validation with static type inference
@MrNiceRicee (reads docs) thank you.