Skip to content

--tsgo-experimental-api: exports of src/hooks.server.ts aren't auto-typed #3152

Open

Description

@xyrolle

Describe the bug

With --tsgo-experimental-api, SvelteKit's zero-config types aren't added to src/hooks.server.ts, so an untyped handle reports implicit any. The default mode, --incremental and --tsgo report nothing for the same project. Untyped src/hooks.client.ts and src/hooks.ts are typed in all four modes.

The Kit file settings in the provider's createFsProxy have serverHooksPath: 'src/hooks.client', the client path twice, so src/hooks.server.ts is never recognized as a Kit file: DiagnosticsProvider.ts#L341-L346.

Reproduction

package.json:

{
  "private": true,
  "type": "module",
  "devDependencies": {
    "@sveltejs/kit": "2.70.3",
    "@typescript/native": "npm:typescript@7.0.2",
    "svelte": "5.57.2",
    "svelte-check": "4.7.7",
    "typescript": "6.0.3"
  }
}

tsconfig.json:

{ "compilerOptions": { "target": "ESNext", "module": "ESNext", "moduleResolution": "bundler", "strict": true, "noEmit": true, "skipLibCheck": true }, "include": ["src/**/*.ts", "src/**/*.svelte"] }

src/hooks.server.ts:

export const handle = ({ event, resolve }) => resolve(event);

src/App.svelte:

<p>app</p>
npm install
npx svelte-check --tsconfig ./tsconfig.json --output machine
npx svelte-check --tsconfig ./tsconfig.json --output machine --incremental
npx svelte-check --tsconfig ./tsconfig.json --output machine --tsgo
npx svelte-check --tsconfig ./tsconfig.json --output machine --tsgo-experimental-api

Output, without the timestamps and the START line:

# default
COMPLETED 115 FILES 0 ERRORS 0 WARNINGS 0 FILES_WITH_PROBLEMS
# --incremental
COMPLETED 2 FILES 0 ERRORS 0 WARNINGS 0 FILES_WITH_PROBLEMS
# --tsgo
COMPLETED 2 FILES 0 ERRORS 0 WARNINGS 0 FILES_WITH_PROBLEMS
# --tsgo-experimental-api
ERROR "src/hooks.server.ts" 1:26 "Binding element 'event' implicitly has an 'any' type."
ERROR "src/hooks.server.ts" 1:33 "Binding element 'resolve' implicitly has an 'any' type."
COMPLETED 2 FILES 2 ERRORS 0 WARNINGS 1 FILES_WITH_PROBLEMS

System Info

svelte-check 4.7.7, typescript 6.0.3, @typescript/native 7.0.2, @sveltejs/kit 2.70.3, svelte 5.57.2, macOS arm64, Node 24.16.0.

Which package is the issue about?

svelte-check

Additional Information

#3154 fixes the path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions