sv-utils: generate the supported Handle import for Kit 2
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start in packages/sv-utils/src/tooling/js/kit.ts at addHooksHandle and inspect both the TypeScript import and JSDoc annotations it generates. Run the project's normal check, or the minimized type check described in the issue, across the supported Kit majors; done means the generated hook uses a valid Handle export and both forms type-check.
Written by the indexing model from the issue text.
Description
Summary
Adding Better Auth to a supported SvelteKit 2 project emits Handle imports from @sveltejs/kit/hooks. Kit 2 declares that type in @sveltejs/kit and does not export it from the hooks module. The generated hook fails type checking independently of the default Kit 3/Better Auth peer conflict.
Steps to reproduce
Start with a working TypeScript SvelteKit 2.70.3 project and use sv 1.0.1 to add the integrations:
npx --yes [email protected] add drizzle=database:sqlite+client:libsql better-auth=demo:password --no-install --no-git-check
Inspect src/hooks.server.ts. The generated import is:
import type { Handle } from '@sveltejs/kit/hooks';
Run the project's normal check. A minimized type check with the published Kit 2.70.3 declarations and TypeScript 6.0.3 also reproduces the error using only this import and export type ConsumerHandle = Handle.
Expected behavior
The hook generator uses the type export provided by the installed Kit major. Kit 2 projects remain supported by the add-on's setup contract and generated hook imports type-check.
Actual behavior
TypeScript reports:
TS2459: Module '"@sveltejs/kit/hooks"' declares 'Handle' locally, but it is not exported.
Changing only the type import to @sveltejs/kit removes that diagnostic. The minimized type check exits 2 before the correction and 0 afterward.
Affected area
packages/sv-utils/src/tooling/js/kit.ts, specifically addHooksHandle, used by the Better Auth add-on. The helper also writes the hooks-module import in JSDoc annotations.
Runtime or environment
sv 1.0.1, SvelteKit 2.70.3, TypeScript 6.0.3, Better Auth 1.7.7, Svelte 5.57.1, Node.js 22.23.2, npm 12.0.2 on macOS ARM64.
Evidence
Current helper at revision 7ff52c0955e1f07b8719029d60afac1ee634ad69 always sources Handle from @sveltejs/kit/hooks. Kit 2.70.3 type declarations import Handle locally in that module but do not export it. An isolated check against those exact declarations confirms the failing and corrected imports.
Impact
Using a Kit 2 dependency graph to satisfy Better Auth's peer requirements still leaves an independently invalid generated hook. The regression condition is that the helper's output type-checks for each supported Kit major, including its TypeScript and JSDoc forms.
- Dominant language
- TypeScript
- Stars
- 513
- Forks
- 110
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sveltejs/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 4 days
-
[bug] Better Auth addon generates legacy D1 binding access with SvelteKit 3 and Cloudflare adapter 8Openbug pkg:add
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sveltejs/cli#1450 · 2 comments ·
Maintainers usually reply within 4 days
-
pkg:add
Difficulty 1/5 Under an hour Newbie friendliness 78/100
sveltejs/cli#1399 · 2 comments ·
Maintainers usually reply within 4 days
-
pkg:migrate
Difficulty 3/5 1-2 days Newbie friendliness 35/100
sveltejs/cli#1461 · 2 comments ·
Maintainers usually reply within 4 days
-
enhancement pkg:migrate
Difficulty 3/5 1-2 days Newbie friendliness 53/100
sveltejs/cli#1440 · 3 comments · 1 reaction ·
Maintainers usually reply within 4 days
Similar issues
-
[analytics-core] getQueryParams does not decode `+` as space and truncates values containing `=`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
amplitude/Amplitude-TypeScript#2179 · 1 comment ·
Maintainers usually reply within 2 days
-
ci good first issue severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
TMHSDigital/GH-Arcade#111 ·
-
AsnIntegerConverter.toASN coerces strings with +value, rounding integers outside safe-integer rangeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PeculiarVentures/asn1-schema#189 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
anaisbetts/spawn-rx#38 ·