Skip to content

Commit ecc3b4c

Browse files
authored
Merge branch 'main' into fix-team-billing-sub-quantity
2 parents 8f8ed1d + 97f2cff commit ecc3b4c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/prisma/zod-utils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import z, { ZodNullable, ZodObject, ZodOptional } from "zod";
44

55
/* eslint-disable no-underscore-dangle */
66
import type {
7+
AnyZodObject,
78
objectInputType,
89
objectOutputType,
910
ZodNullableDef,
@@ -528,11 +529,13 @@ export const optionToValueSchema = <T extends z.ZodTypeAny>(valueSchema: T) =>
528529
* @url https://github.com/colinhacks/zod/discussions/1655#discussioncomment-4367368
529530
*/
530531
export const getParserWithGeneric =
531-
<T extends z.ZodTypeAny>(valueSchema: T) =>
532+
<T extends AnyZodObject>(valueSchema: T) =>
532533
<Data>(data: Data) => {
533-
type Output = z.infer<typeof valueSchema>;
534+
type Output = z.infer<T>;
535+
type SimpleFormValues = string | number | null | undefined;
534536
return valueSchema.parse(data) as {
535-
[key in keyof Data]: key extends keyof Output ? Output[key] : Data[key];
537+
// TODO: Invesitage why this broke on zod 3.22.2 upgrade
538+
[key in keyof Data]: Data[key] extends SimpleFormValues ? Data[key] : Output[key];
536539
};
537540
};
538541
export const sendDailyVideoRecordingEmailsSchema = z.object({

0 commit comments

Comments
 (0)