Skip to content

Commit 5987d5a

Browse files
fix: apply skipValidation to all presets when set on parent (#326)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
1 parent 5f68dca commit 5987d5a

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.changeset/healthy-windows-melt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@t3-oss/env-core": minor
3+
---
4+
5+
update skipValidation flag to skip validation for extended presets

docs/src/app/docs/customization/page.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Skipping validation is not encouraged and will lead to your types and runtime va
1616

1717
</Callout>
1818

19+
When enabled, validation will be skipped for both your environment variables and any [extended presets](#extending-presets).
20+
1921
```ts title="src/env.ts"
2022
import { createEnv } from "@t3-oss/env-core";
2123

packages/core/src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,16 @@ export function createEnv<
324324
}
325325

326326
const skip = !!opts.skipValidation;
327-
if (skip) return runtimeEnv as any;
327+
if (skip) {
328+
if (opts.extends) {
329+
for (const preset of opts.extends) {
330+
preset.skipValidation = true;
331+
}
332+
}
333+
334+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
335+
return runtimeEnv as any;
336+
}
328337

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

0 commit comments

Comments
 (0)