Skip to content

Commit baa2b57

Browse files
authored
Ensure the switch in convexToZod is exhaustive (#825)
2 parents 9cdfdb2 + e5f18a1 commit baa2b57

File tree

1 file changed

+6
-2
lines changed
  • packages/convex-helpers/server

1 file changed

+6
-2
lines changed

packages/convex-helpers/server/zod.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,8 @@ export function convexToZod<V extends GenericValidator>(
14201420

14211421
let zodValidator: z.ZodTypeAny;
14221422

1423-
switch (convexValidator.kind) {
1423+
const { kind } = convexValidator;
1424+
switch (kind) {
14241425
case "id":
14251426
zodValidator = zid((convexValidator as VId<any>).tableName);
14261427
break;
@@ -1483,8 +1484,11 @@ export function convexToZod<V extends GenericValidator>(
14831484
);
14841485
break;
14851486
}
1487+
case "bytes":
1488+
throw new Error("v.bytes() is not supported");
14861489
default:
1487-
throw new Error(`Unknown convex validator type: ${convexValidator.kind}`);
1490+
kind satisfies never;
1491+
throw new Error(`Unknown convex validator type: ${kind}`);
14881492
}
14891493

14901494
return isOptional

0 commit comments

Comments
 (0)