From 4ea9cbc5512a8866e82debd058eb07d52d8982fb Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Wed, 11 Feb 2026 00:17:46 +0100 Subject: [PATCH] fix(next-utils): use natural type inference for validateMintelEnv to fix unknown type errors --- packages/next-utils/package.json | 2 +- packages/next-utils/src/env.ts | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/next-utils/package.json b/packages/next-utils/package.json index 550f2fb..547afb7 100644 --- a/packages/next-utils/package.json +++ b/packages/next-utils/package.json @@ -1,6 +1,6 @@ { "name": "@mintel/next-utils", - "version": "1.7.4", + "version": "1.7.5", "publishConfig": { "access": "public", "registry": "https://npm.infra.mintel.me" diff --git a/packages/next-utils/src/env.ts b/packages/next-utils/src/env.ts index 8ba28c2..cf102cb 100644 --- a/packages/next-utils/src/env.ts +++ b/packages/next-utils/src/env.ts @@ -52,9 +52,7 @@ export const mintelEnvSchema = { export function validateMintelEnv< T extends z.ZodRawShape = Record, ->( - schemaExtension: T = {} as T, -): z.infer> { +>(schemaExtension: T = {} as T) { const fullSchema = z.object(mintelEnvSchema).extend(schemaExtension); const isBuildTime = @@ -68,7 +66,7 @@ export function validateMintelEnv< console.warn( "⚠️ Some environment variables are missing during build, but skipping strict validation.", ); - // Return process.env casted to ensure types match for the full schema + // Return process.env casted to the full schema type to unblock builds return process.env as unknown as z.infer; } @@ -79,5 +77,5 @@ export function validateMintelEnv< throw new Error("Invalid environment variables"); } - return result.data as z.infer; + return result.data; }