Title: @sentry/sveltekit: `Handle` and `ResolveOptions` types are `any` under SvelteKit 3 (imported from `@sveltejs/kit` instead of `@sveltejs/kit/hooks`) · Issue #25924 · getsentry/sentry-javascript · GitHub
Open Graph Title: @sentry/sveltekit: `Handle` and `ResolveOptions` types are `any` under SvelteKit 3 (imported from `@sveltejs/kit` instead of `@sveltejs/kit/hooks`) · Issue #25924 · getsentry/sentry-javascript
X Title: @sentry/sveltekit: `Handle` and `ResolveOptions` types are `any` under SvelteKit 3 (imported from `@sveltejs/kit` instead of `@sveltejs/kit/hooks`) · Issue #25924 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation I am using the latest SDK release How do you use Sentry? Sentry Saas (sentry....
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation I am using the latest SDK release How...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation I am using the latest SDK release How...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25924
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@sentry/sveltekit: `Handle` and `ResolveOptions` types are `any` under SvelteKit 3 (imported from `@sveltejs/kit` instead of `@sveltejs/kit/hooks`)","articleBody":"### Is there an existing issue for this?\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation\n- [x] I am using the latest SDK release\n\n### How do you use Sentry?\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n@sentry/sveltekit\n\n### SDK Version\n11.10.0\n\n### Framework Version\nSvelteKit 3.1.0 (svelte 5.57.2, TypeScript 6.0.3 with `strict`, Cloudflare adapter)\n\n### Link to Sentry event\nn/a (type-level issue)\n\n### Reproduction Example/SDK Setup\n\n```ts\n// src/hooks.server.ts\nimport * as Sentry from '@sentry/sveltekit';\nimport { sequence, type Handle } from '@sveltejs/kit/hooks';\n\nconst initHandle = Sentry.initCloudflareSentryHandle({ dsn: '...' });\nconst sentryHandle = Sentry.sentryHandle();\n\n// Both of these compile, so the return types are `any`:\nconst a: number = initHandle;\nconst b: number = sentryHandle;\n\nexport const handle: Handle = sequence(initHandle, sentryHandle);\n```\n\n`tsconfig.json`: `\"strict\": true`, `\"moduleResolution\": \"bundler\"`, `\"skipLibCheck\": true`.\n\n### Steps to Reproduce\n1. Install `@sentry/sveltekit@11.10.0` with `@sveltejs/kit@3.1.0` and TypeScript.\n2. Add the snippet above and run `tsc --noEmit`. It passes, including the two `number` assignments.\n3. Run `tsc --noEmit --skipLibCheck false`. The SDK's declarations fail to resolve:\n\n```\nnode_modules/@sentry/sveltekit/build/types/server-common/handle.d.ts(1,15): error TS2305: Module '\"@sveltejs/kit\"' has no exported member 'Handle'.\nnode_modules/@sentry/sveltekit/build/types/server-common/handle.d.ts(1,23): error TS2305: Module '\"@sveltejs/kit\"' has no exported member 'ResolveOptions'.\nnode_modules/@sentry/sveltekit/build/types/server/handle.d.ts(2,15): error TS2305: Module '\"@sveltejs/kit\"' has no exported member 'Handle'.\nnode_modules/@sentry/sveltekit/build/types/worker/cloudflare.d.ts(2,15): error TS2305: Module '\"@sveltejs/kit\"' has no exported member 'Handle'.\n```\n\n### Expected Result\n`sentryHandle()` and `initCloudflareSentryHandle()` return SvelteKit's `Handle` type under SvelteKit 3, as they do under SvelteKit 2. The `number` assignments in the snippet should be type errors.\n\n### Actual Result\nUnder SvelteKit 3, the SDK's declarations import `Handle` and `ResolveOptions` from `@sveltejs/kit`:\n\n```ts\n// build/types/server-common/handle.d.ts, line 1\nimport type { Handle, ResolveOptions } from '@sveltejs/kit';\n```\n\n`build/types/server/handle.d.ts` and `build/types/worker/cloudflare.d.ts` import `Handle` the same way.\n\nSvelteKit 3 declares both types in the `@sveltejs/kit/hooks` module, next to `sequence`, and no longer exports them from `@sveltejs/kit`. The import fails to resolve, so `Handle` becomes `any`, and so does everything typed with it: the return types of `sentryHandle()` and `initCloudflareSentryHandle()`, and `SentryHandleOptions` fields that use `ResolveOptions`.\n\nWith the usual `skipLibCheck: true` this is silent: `tsc` passes, and any mistake in how the handle is used goes unchecked. Type-aware linting reports it, though. `typescript-eslint`'s `strictTypeChecked` config flags every use of these handles with `no-unsafe-assignment`, `no-unsafe-argument` and `no-unsafe-call`. Our workaround is casting both return values `as Handle`.\n\n### Additional Context\n**Likely cause:** `package.json` declares the peer `\"@sveltejs/kit\": \"2.x || 3.x\"`, but the devDependency the declarations are built against is `\"@sveltejs/kit\": \"^2.70.2\"`. Under Kit 2 these imports resolve, so the build doesn't catch it.\n\nThe other `@sveltejs/kit` type imports in `build/types` (`RequestEvent`, `HttpError`, `Redirect`, `Adapter`) still exist on `@sveltejs/kit` in 3.1.0, so only `Handle` and `ResolveOptions` seem affected.\n\n**Possible fix that works on both majors:** both Kit 2 and Kit 3 export `sequence` from `@sveltejs/kit/hooks`, typed with `Handle`, so the type can be derived from it instead of imported by name:\n\n```ts\nimport type { sequence } from '@sveltejs/kit/hooks';\ntype Handle = ReturnType\u003ctypeof sequence>;\ntype ResolveOptions = NonNullable\u003cParameters\u003cParameters\u003cHandle>[0]['resolve']>[1]>;\n```\n","author":{"url":"https://github.com/samuelkubinsky","@type":"Person","name":"samuelkubinsky"},"datePublished":"2026-10-30T05:42:36Z","url":"https://github.com/getsentry/sentry-javascript/issues/25924"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4e535401-3ba3-f4c3-15f0-2b7e05606ccb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E37A:3990B6:3EE61:53E9E:6B043182 |
| html-safe-nonce | da63a2258cb2148e4bc78908419dd916046cf29d9dc09c94cae5867354249a35 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzdBOjM5OTBCNjozRUU2MTo1M0U5RTo2QjA0MzE4MiIsInZpc2l0b3JfaWQiOiIzMTA5NTIwNTQyNzI2ODkzOTU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 179fe1c71637af774469e6176c0a7662efc679efc9089cb59a9ab0502497ea30 |
| hovercard-subject-tag | issue:6113913449 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25924/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8d9a587a547cbc026d5bb8d172bceb13716191a6b1c7b30afda77536f9dfb7a3/getsentry/sentry-javascript/issues/25924 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8d9a587a547cbc026d5bb8d172bceb13716191a6b1c7b30afda77536f9dfb7a3/getsentry/sentry-javascript/issues/25924 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation I am using the latest SDK release How... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | samuelkubinsky |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width