fix(shared): parse an id param's digits with Number before the integer check

The union of an integer and a digit string fed z.coerce.number() through pipe(), which Zod 4 types with an unknown input and tsc refuses. The digits are now turned into a number with Number and checked by z.number().int().positive(), the same rule as before.
This commit is contained in:
Maurice
2026-11-18 13:24:09 +01:00
parent cdc31967b2
commit 26b220470a
+2 -1
View File
@@ -18,7 +18,8 @@ export type Id = z.infer<typeof idSchema>;
*/
export const idParamSchema = z
.union([z.number().int(), z.string().regex(/^\d+$/)])
.pipe(z.coerce.number().int().positive());
.transform(Number)
.pipe(z.number().int().positive());
/**
* A row id written as text: decimal digits naming a safe integer, kept as the