fix(next-utils): finalize type safety for validateMintelEnv and fix pre-push hook
Some checks failed
Monorepo Pipeline / 🧪 Quality Assurance (push) Failing after 2m7s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Directus (Base) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped

This commit is contained in:
2026-02-11 00:10:38 +01:00
parent 858c7bbc39
commit b65b9a7fb2
20 changed files with 25 additions and 23 deletions

View File

@@ -52,7 +52,9 @@ export const mintelEnvSchema = {
export function validateMintelEnv<
T extends z.ZodRawShape = Record<string, never>,
>(schemaExtension: T = {} as T) {
>(
schemaExtension: T = {} as T,
): z.infer<z.ZodObject<typeof mintelEnvSchema & T>> {
const fullSchema = z.object(mintelEnvSchema).extend(schemaExtension);
const isBuildTime =
@@ -66,7 +68,7 @@ export function validateMintelEnv<
console.warn(
"⚠️ Some environment variables are missing during build, but skipping strict validation.",
);
// Return process.env casted to the full schema type to unblock builds
// Return process.env casted to ensure types match for the full schema
return process.env as unknown as z.infer<typeof fullSchema>;
}
@@ -77,5 +79,5 @@ export function validateMintelEnv<
throw new Error("Invalid environment variables");
}
return result.data;
return result.data as z.infer<typeof fullSchema>;
}