Closed w1am closed 11 months ago
I'm currently trying to use toZod with a generic type, specifically with the Option type I've defined in my code. Here's what my code looks like:
import { z } from 'zod'; import { toZod } from "tozod"; export type Option<T> = { value: T; label: string; } export const OptionSchema = <T>(valueSchema: z.ZodType<T>) => z.object({ value: valueSchema, label: z.string() });
How can I use toZod with the generic type Option<T>?
toZod
Option<T>
I'm currently trying to use toZod with a generic type, specifically with the Option type I've defined in my code. Here's what my code looks like:
How can I use
toZod
with the generic typeOption<T>
?