Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended configurations do not respect skipValidation #323

Open
oswaldoacauan opened this issue Mar 12, 2025 · 0 comments
Open

Extended configurations do not respect skipValidation #323

oswaldoacauan opened this issue Mar 12, 2025 · 0 comments

Comments

@oswaldoacauan
Copy link

I would expect that when extending a preset it would respect the skipValidation flag of where it was extended, instead it only follows the preset skipValidation configuration.

// packages/auth/env.ts
import { createEnv } from "@t3-oss/env-core";
export const env = () => createEnv({
  // no skipValidation set
});
 
// apps/web/env.ts
import { createEnv } from "@t3-oss/env-nextjs";
import { env as authEnv } from "@repo/auth/env";
 
export const env = createEnv({
  // ...
  extends: [authEnv()],
  skipValidation: !!process.env.SKIP_ENV_VALIDATION,
});

For the code above I would expect that if SKIP_ENV_VALIDATION=true all validations will be skipped, but thats not the case, the validations for /packages/auth/env.ts will still run.

To fix it, I need to replicate the skipValidation: !!process.env.SKIP_ENV_VALIDATION, on each of my presets.

Demo: https://codesandbox.io/p/devbox/7jhxrg

Is this the expected behaviour? It probably should be mentioned at least somewhere in the docs that presets are fully independent configurations and that they run in a standalone mode regardless of the options of where they were extended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant