Skip to content

svelte-check --incremental skips standalone .ts files #3004

@Hoffs

Description

@Hoffs

Describe the bug

In our project svelte-check --incremental only checks ~626 files (.svelte files and their direct dependencies) while the non-incremental mode checks ~9,962 files including all standalone .ts files in the project. Type errors in standalone .ts server files (e.g. +server.ts, utility modules) are silently missed.

This occurs even on a completely fresh run with no cache present.

Reproduction

Given a SvelteKit project with a type error in a standalone .ts file:

pnpm dlx sv create myappapp --template minimal --types ts
// src/lib/api/example/+server.ts
import { json, type RequestHandler } from "@sveltejs/kit";

export const GET: RequestHandler = async () => {
  try {
    return json({});
  } catch (err) {
    throw new Error(`Failed: ${error}`); // undefined variable
  }
};

Then running svelte-check with incremental and without:

> rm -rf .svelte-kit/.svelte-check
> pnpm svelte-check --incremental --tsconfig ./tsconfig.json
Loading svelte-check in workspace: /Users/ignas/work-repos/test-svelte-repro/myappapp
Getting Svelte diagnostics...

svelte-check found 0 errors and 0 warnings

> pnpm svelte-check --tsconfig ./tsconfig.json
Loading svelte-check in workspace: /Users/ignas/work-repos/test-svelte-repro/myappapp
Getting Svelte diagnostics...

/Users/ignas/work-repos/test-svelte-repro/myappapp/src/routes/api/example/+server.ts:7:32
Error: Cannot find name 'error'. Did you mean 'err'?
  } catch (err) {
    throw new Error(`Failed: ${error}`); // undefined variable
  }

====================================
svelte-check found 1 error and 0 warnings in 1 file

> # with tsgo installed
> pnpm svelte-check --tsconfig --tsgo ./tsconfig.json
Loading svelte-check in workspace: /Users/ignas/work-repos/test-svelte-repro/myappapp
Getting Svelte diagnostics...

/Users/ignas/work-repos/test-svelte-repro/myappapp/src/routes/api/example/+server.ts:7:32
Error: Cannot find name 'error'. Did you mean 'err'? (ts)
  } catch (err) {
    throw new Error(`Failed: ${error}`); // undefined variable
  }

====================================
svelte-check found 1 error and 0 warnings in 1 file

Expected behaviour

--incremental should check the same file set as non-incremental mode, including standalone .ts/.js files in the tsconfig include glob.

System Info

  "devDependencies": {
    "@sveltejs/adapter-auto": "^7.0.1",
    "@sveltejs/kit": "^2.57.0",
    "@sveltejs/vite-plugin-svelte": "^7.0.0",
    "svelte": "^5.55.2",
    "svelte-check": "^4.4.6",
    "typescript": "^6.0.2",
    "vite": "^8.0.7"
  },
  "dependencies": {
    "@typescript/native-preview": "7.0.0-dev.20260410.1"
  }

Node 22.x,
macOS arm64

Which package is the issue about?

svelte-check

Additional Information, eg. Screenshots

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions