From e5f18a14b3b1587741ed6b7e34aed0346fa30062 Mon Sep 17 00:00:00 2001 From: Nicolas Ettlin Date: Tue, 21 Oct 2025 15:20:53 -0700 Subject: [PATCH] Ensure the `switch` in `convexToZod` is exhaustive --- packages/convex-helpers/server/zod.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/convex-helpers/server/zod.ts b/packages/convex-helpers/server/zod.ts index 4ddf1f6c..8ea3650d 100644 --- a/packages/convex-helpers/server/zod.ts +++ b/packages/convex-helpers/server/zod.ts @@ -1420,7 +1420,8 @@ export function convexToZod( let zodValidator: z.ZodTypeAny; - switch (convexValidator.kind) { + const { kind } = convexValidator; + switch (kind) { case "id": zodValidator = zid((convexValidator as VId).tableName); break; @@ -1483,8 +1484,11 @@ export function convexToZod( ); break; } + case "bytes": + throw new Error("v.bytes() is not supported"); default: - throw new Error(`Unknown convex validator type: ${convexValidator.kind}`); + kind satisfies never; + throw new Error(`Unknown convex validator type: ${kind}`); } return isOptional