Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/healthy-windows-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@t3-oss/env-core": minor
---

update skipValidation flag to skip validation for extended presets
2 changes: 2 additions & 0 deletions docs/src/app/docs/customization/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Skipping validation is not encouraged and will lead to your types and runtime va

</Callout>

When enabled, validation will be skipped for both your environment variables and any [extended presets](#extending-presets).

```ts title="src/env.ts"
import { createEnv } from "@t3-oss/env-core";

Expand Down
11 changes: 10 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,16 @@ export function createEnv<
}

const skip = !!opts.skipValidation;
if (skip) return runtimeEnv as any;
if (skip) {
if (opts.extends) {
for (const preset of opts.extends) {
preset.skipValidation = true;
}
}

// biome-ignore lint/suspicious/noExplicitAny: <explanation>
return runtimeEnv as any;
}

const _client = typeof opts.client === "object" ? opts.client : {};
const _server = typeof opts.server === "object" ? opts.server : {};
Expand Down