breaking: move env-related types to @sveltejs/kit/env - #16739
Merged
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/9a4ecd63a6313d9e20ce120fcd12756169d64137Open in |
🦋 Changeset detectedLatest commit: 9a4ecd6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Member
Author
|
/autofix |
…c.d.ts` breaks internal JSDoc imports that still pull them from `@sveltejs/kit`, and the tsconfig `paths` for `@sveltejs/kit/env` still points at the runtime `index.js` (no types), so source typechecking (`pnpm check`) fails.
This commit fixes the issue reported at packages/kit/src/exports/env/index.js:2
## Bug
This PR deleted `EnvVarConfig` and `DefinedEnvVars` from `packages/kit/src/exports/public.d.ts` and relocated them to the new `packages/kit/src/exports/env/public.d.ts`. Verified:
- `grep EnvVarConfig|DefinedEnvVars` in `src/exports/public.d.ts` → **no matches** (they were removed).
- Both types are now declared only in `src/exports/env/public.d.ts`.
However, the tsconfig `paths` map resolves the bare package specifier to the (now stripped) barrel:
```jsonc
"@sveltejs/kit": ["./src/exports/public.d.ts"],
```
and every internal file still imports the moved types from `@sveltejs/kit`:
- `src/exports/env/index.js:2`
- `src/exports/internal/env.js:2`
- `src/exports/vite/index.js:1`
- `src/core/adapt/builder.js:4`
- `src/core/adapt/index.js:13` (inline `import('@sveltejs/kit').EnvVarConfig`)
- `src/core/env.js:2`
- `src/core/sync/write_env.js:1`
During source typechecking (`pnpm check` → tsc), each of these resolves `@sveltejs/kit` to `public.d.ts`, which no longer exports `EnvVarConfig`/`DefinedEnvVars`, producing `Module '@sveltejs/kit' has no exported member 'EnvVarConfig'` (and `DefinedEnvVars`).
Additionally, the `@sveltejs/kit/env` path entry pointed to the runtime module:
```jsonc
"@sveltejs/kit/env": ["./src/exports/env/index.js"],
```
`index.js` only exports the `defineEnvVars` function — it does not declare the types (the `.d.ts` does `export * from './index.js'` and then adds the type declarations). So merely repointing the imports to `@sveltejs/kit/env` would still not resolve the types unless the tsconfig path also targeted the `.d.ts`.
This mirrors exactly what the earlier `@sveltejs/kit/params` move (same umbrella issue #16676) did correctly: `"@sveltejs/kit/params": ["./src/exports/params/public.d.ts"]` plus internal imports from `@sveltejs/kit/params`.
## Fix
1. Repointed the tsconfig path to the declaration file:
```jsonc
"@sveltejs/kit/env": ["./src/exports/env/public.d.ts"],
```
2. Updated all internal JSDoc imports of `EnvVarConfig`/`DefinedEnvVars` to import from `@sveltejs/kit/env`. Where a file imported both a moved env type and a type that still lives in the main barrel (e.g. `KitConfig` in `vite/index.js`, `RouteDefinition` in `builder.js`), the import was split into two `@import` lines so the remaining types keep resolving via `@sveltejs/kit`.
I could not execute `tsc` here because the sandbox has no installed `node_modules`/`@typescript/native`, but the failure is structural (a resolved module missing an exported member) and the fix restores the exact pattern already proven for the `params` migration.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Rich-Harris <hello@rich-harris.dev>
elliott-with-the-longest-name-on-github
approved these changes
Aug 11, 2026
Rich-Harris
pushed a commit
that referenced
this pull request
Aug 11, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to version-3, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `version-3` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `version-3`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @sveltejs/kit@3.0.0-next.20 ### Major Changes - breaking: move remote function types to `$app/server` ([#16740](#16740)) - breaking: remove `#lib` definition from `paths`; requires explicit module extensions as a result ([#16736](#16736)) - breaking: move hooks-related types to `@sveltejs/kit/hooks` ([#16737](#16737)) - breaking: move env-related types to `@sveltejs/kit/env` ([#16739](#16739)) ### Minor Changes - feat: better response logging ([#16744](#16744)) ### Patch Changes - chore: bump `mrmime` to 2.0.1 ([#16745](#16745)) - chore: bump `@sveltejs/acorn-typescript` to 1.0.12 ([#16745](#16745)) - chore: bump `magic-string` to 1.1.0 ([#16745](#16745)) - chore: bump `devalue` to 5.9.0 ([#16745](#16745)) - chore: bump `cookie` to 2.0.1 ([#16745](#16745)) - chore: bump `acorn` to 8.18.0 ([#16745](#16745)) - fix: avoid infinite loop when building with `--watch` flag ([#16632](#16632)) ## @sveltejs/adapter-cloudflare@8.0.0-next.6 ### Patch Changes - chore: bump `@cloudflare/worker-types` to 5.20260809.1 ([#16745](#16745)) - Updated dependencies [[`1742811`](1742811), [`1611c61`](1611c61), [`b361b81`](b361b81), [`b361b81`](b361b81), [`b361b81`](b361b81), [`b361b81`](b361b81), [`13e7b18`](13e7b18), [`529346d`](529346d), [`b361b81`](b361b81), [`81d6319`](81d6319), [`b361b81`](b361b81), [`69a5bdf`](69a5bdf)]: - @sveltejs/kit@3.0.0-next.20 ## @sveltejs/adapter-netlify@7.0.0-next.8 ### Patch Changes - chore: bump `rolldown` to 1.2.3 ([#16745](#16745)) - Updated dependencies [[`1742811`](1742811), [`1611c61`](1611c61), [`b361b81`](b361b81), [`b361b81`](b361b81), [`b361b81`](b361b81), [`b361b81`](b361b81), [`13e7b18`](13e7b18), [`529346d`](529346d), [`b361b81`](b361b81), [`81d6319`](81d6319), [`b361b81`](b361b81), [`69a5bdf`](69a5bdf)]: - @sveltejs/kit@3.0.0-next.20 ## @sveltejs/adapter-node@6.0.0-next.10 ### Patch Changes - chore: bump `rolldown` to 1.2.3 ([#16745](#16745)) - Updated dependencies [[`1742811`](1742811), [`1611c61`](1611c61), [`b361b81`](b361b81), [`b361b81`](b361b81), [`b361b81`](b361b81), [`b361b81`](b361b81), [`13e7b18`](13e7b18), [`529346d`](529346d), [`b361b81`](b361b81), [`81d6319`](81d6319), [`b361b81`](b361b81), [`69a5bdf`](69a5bdf)]: - @sveltejs/kit@3.0.0-next.20 ## @sveltejs/enhanced-img@1.0.0-next.5 ### Patch Changes - chore: bump `magic-string` to 1.1.0 ([#16745](#16745)) - chore: bump `zimmerframe` to 1.1.4 ([#16745](#16745)) ## @sveltejs/package@3.0.0-next.6 ### Patch Changes - chore: bump `svelte2tsx` to 0.7.59 ([#16745](#16745)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another part of #16676
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits