import z from "zod" export function updateSchema(schema: z.ZodObject) { const next = {} as { [K in keyof T]: z.ZodOptional> } for (const [k, v] of Object.entries(schema.required().shape) as [keyof T & string, z.ZodTypeAny][]) { next[k] = v.nullable() as unknown as (typeof next)[typeof k] } return z.object(next) }