diff --git a/packages/prisma/zod-utils.ts b/packages/prisma/zod-utils.ts index 61ef2c6fa0..1b62e2e1d3 100644 --- a/packages/prisma/zod-utils.ts +++ b/packages/prisma/zod-utils.ts @@ -4,6 +4,7 @@ import z, { ZodNullable, ZodObject, ZodOptional } from "zod"; /* eslint-disable no-underscore-dangle */ import type { + AnyZodObject, objectInputType, objectOutputType, ZodNullableDef, @@ -528,11 +529,13 @@ export const optionToValueSchema = (valueSchema: T) => * @url https://github.com/colinhacks/zod/discussions/1655#discussioncomment-4367368 */ export const getParserWithGeneric = - (valueSchema: T) => + (valueSchema: T) => (data: Data) => { - type Output = z.infer; + type Output = z.infer; + type SimpleFormValues = string | number | null | undefined; return valueSchema.parse(data) as { - [key in keyof Data]: key extends keyof Output ? Output[key] : Data[key]; + // TODO: Invesitage why this broke on zod 3.22.2 upgrade + [key in keyof Data]: Data[key] extends SimpleFormValues ? Data[key] : Output[key]; }; }; export const sendDailyVideoRecordingEmailsSchema = z.object({