From c03a3ad2a48b2ff37ddef2be555a26201ff7097f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 21 Feb 2024 17:30:18 +0100 Subject: [PATCH] chore(types): improve extended zod types --- src/runtime/server/utils/zod.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime/server/utils/zod.ts b/src/runtime/server/utils/zod.ts index 87d5cc7e..6e8321a8 100644 --- a/src/runtime/server/utils/zod.ts +++ b/src/runtime/server/utils/zod.ts @@ -1,6 +1,11 @@ import { z as zod } from 'zod' -export const z = { +interface ExtendedZodMethods { + intAsString: () => zod.ZodEffects +} +type ExtendedZod = typeof zod & ExtendedZodMethods + +export const z: ExtendedZod = { ...zod, intAsString: () => zod.string().transform(val => parseInt(val, 10)) }