breaking: move hooks-related types to @sveltejs/kit/hooks - #16737
Merged
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/313ab712bafeebd864971bb7fd4d57d5839a3ab8Open in |
🦋 Changeset detectedLatest commit: 313ab71 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 |
…ort`/`CaughtError`/`HandleServerError`/`ClientCaughtError` from `@sveltejs/kit`, but those types were moved to `@sveltejs/kit/hooks`, breaking `pnpm check` (checkJs).
This commit fixes the issue reported at packages/kit/src/exports/hooks/sequence.js:1
## The bug
This PR moved several public types out of `packages/kit/src/exports/public.d.ts` and into `packages/kit/src/exports/hooks/public.d.ts`.
Verified in the current tree:
* `grep` for `Handle|ResolveOptions|Transport|CaughtError|HandleServerError|ClientCaughtError` in `src/exports/public.d.ts` → **no matches** (removed).
* They now live in `src/exports/hooks/public.d.ts`:
* `Handle` (13), `CaughtError` (37), `ClientCaughtError` (53), `HandleServerError` (69), `Transport` (151), `ResolveOptions` (164).
* `public.d.ts` does **not** re-export the hooks module (`export * from './index.js'` at line 2049, not from `./hooks`), so these members are no longer reachable via `@sveltejs/kit`.
* `RequestEvent` (public.d.ts:1197) and `ServerInitOptions` (public.d.ts:1349) were **not** moved and correctly stay on `@sveltejs/kit`.
Because `packages/kit/tsconfig.json` maps `@sveltejs/kit` → `./src/exports/public.d.ts` with `checkJs: true`, every JSDoc reference to a moved type produces a concrete compile error (`TS2305` for `@import`, `TS2694` for inline `import('...').X`), so `pnpm check` fails.
### Affected references (all confirmed present)
* `src/exports/hooks/sequence.js:1` — `@import { Handle, RequestEvent, ResolveOptions }`
* `src/runtime/app/internal/transport.js:1` — `@import { Transport }`
* `src/runtime/server/respond.js:579` — `import('@sveltejs/kit').ResolveOptions`
* `src/runtime/server/page/load_data.js:263` — `import('@sveltejs/kit').ResolveOptions`
* `src/runtime/server/errors.js:51` — `import('@sveltejs/kit').CaughtError`
* `src/runtime/server/errors.js:80` — `import('@sveltejs/kit').HandleServerError`
* `src/runtime/client/client.js:2521` — `import('@sveltejs/kit').ClientCaughtError`
## The fix
1. Added a `@sveltejs/kit/hooks` → `./src/exports/hooks/public.d.ts` mapping to `tsconfig.json` `paths` (the `./hooks` subpath already exists in `package.json`, but the path-mapping used by `check` lacked it).
2. Repointed every moved-type reference above to `@sveltejs/kit/hooks`, keeping `RequestEvent` on `@sveltejs/kit`.
3. Also updated the two `/// type: import('@sveltejs/kit').Handle` annotations in `sequence.js`'s JSDoc example (lines 21/40) so the rendered docs show the correct import location. Left `ServerInitOptions` (server/index.js:86) untouched since it did not move.
## Verification note
`pnpm check` could not be executed here: the sandbox lacks the `@typescript/native` tsc binary and `node_modules` are out of sync (no `tsc` available anywhere). The resolution is deterministic and each type is restored to a module that actually exports it.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Rich-Harris <hello@rich-harris.dev>
Member
|
/autofix |
Member
|
yes needs changes to language tools, I can check that part |
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
elliott-with-the-longest-name-on-github
approved these changes
Aug 11, 2026
elliott-with-the-longest-name-on-github
left a comment
Contributor
There was a problem hiding this comment.
🔥
Nic-Polumeyv
approved these changes
Aug 11, 2026
This reverts commit 0f504c5.
…eLiveQuery` imported twice in `internal.d.ts` — once from `@sveltejs/kit` (where they no longer exist) and once from `$app/server`.
This commit fixes the issue reported at packages/kit/src/types/internal.d.ts:18
## Bug
In `packages/kit/src/types/internal.d.ts`, the version-3 merge moved the remote-function types (`RemoteFormIssue`, `RemoteQuery`, `RemoteLiveQuery`) out of `@sveltejs/kit` and into `$app/server`, but the merge resolution left the old import in place while also adding the new one:
```ts
import {
...
Emulator,
RemoteFormIssue,
RemoteQuery,
RemoteLiveQuery
} from '@sveltejs/kit';
import { RemoteFormIssue, RemoteQuery, RemoteLiveQuery } from '$app/server';
```
This produces two distinct TypeScript errors:
1. **TS2305 "has no exported member"** — I verified these three identifiers are no longer exported from `@sveltejs/kit` (`grep` in `src/exports/public.d.ts` returns no matches).
2. **TS2300 "Duplicate identifier"** — the same three names are imported in both statements.
They *are* now defined/exported from `$app/server` (`src/runtime/app/server/public.d.ts`, e.g. `export interface RemoteFormIssue`, `export type RemoteQuery<T>`, `export type RemoteLiveQuery<T>`), confirming the `$app/server` import is the correct one.
This would break `pnpm check`.
## Fix
Removed `RemoteFormIssue`, `RemoteQuery`, and `RemoteLiveQuery` from the `@sveltejs/kit` import block (and cleaned up the trailing comma after `Emulator`), leaving the `$app/server` import as the sole source of these types.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: teemingc <chewteeming01@gmail.com>
Member
|
/autofix |
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>
dummdidumm
added a commit
to sveltejs/language-tools
that referenced
this pull request
Aug 12, 2026
Import sources have changed in sveltejs/kit#16737
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. @dummdidumm will this need changes to the auto-injected types?
The diff is larger than it needs to be, presumably because of formatting-related changes after switching to
oxfmtPlease 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