Fast CLI type checking for Svelte 4, Svelte 5, and SvelteKit, written in Rust and powered by TypeScript 7's native compiler.
Use it in place of svelte-check in check scripts, CI, and pre-commit hooks. It supports familiar flags and output formats, with compatibility differences documented below.
Performance · Quick start · Compatibility · Configuration · Troubleshooting · Contributing
Recorded on a SvelteKit + TypeScript monorepo with 1,357 .svelte files.
| Tool | Cold | Warm | After an edit | Errors / warnings / files with problems |
|---|---|---|---|---|
| svelte-check-native | 3.4 s | 0.3 s | 3.2 s | 7 / 49 / 23 |
| svelte-check-native (tsrs) | 1.3 s | 0.3 s | 1.1 s | 7 / 49 / 23 |
| svelte-check | 25.8 s | 25.9 s | 26.2 s | 7 / 49 / 23 |
| svelte-check --tsgo | 13.4 s | 13.2 s | 13.8 s | 7 / 49 / 23 |
Each result is a mean of two runs. Benched on M1 Pro with 8 CPU. svelte-check-native 1.10.0 and svelte-check 4.7.7, both type-checking with TypeScript 7.0.0-dev.20260618.1. tsrs 0.18.0. svelte-check without --tsgo uses the project's TypeScript 6.0.2.
svelte-check-native --tsconfig tsconfig.json --diagnostic-sources 'ts,svelte'See the benchmark script for the cold, warm, and single-file-edit scenarios.
Install the checker and its TypeScript engine in your existing Svelte project:
npm install -D svelte-check-native typescript@^7.0.0
npx svelte-check-native --workspace .Requires typescript 7+ or @typescript/native-preview (tsgo). TypeScript 6 and earlier cannot run checks; you can keep them in your project and install @typescript/native-preview instead of TypeScript 7. The checker prefers TypeScript 7+ when both are installed.
TypeScript 7.1 nightlies (typescript@next) work from 7.1.0-dev.20261027.1 on. Skip 7.1.0-beta: it types a missing .svelte import through Svelte's *.svelte wildcard (microsoft/TypeScript#64882), so you get extra errors beside the real TS2307. --disable-enhance avoids them on the beta, but then a missing import goes unreported, as in svelte-check --tsgo.
Replace svelte-check in your package.json check script, keeping your supported flags. For example:
{
"scripts": {
"check": "svelte-check-native --workspace ."
}
}Then run npm run check locally or in CI. A tsconfig.json or jsconfig.json is required.
tsrs is a Rust port of the TypeScript 7 checker. In benchmarks on two SvelteKit apps (1,124 and 1,357 files), its type-check step ran 3.5–4× faster with 2.7–3.1× less peak memory than the TypeScript nightly it is pinned to, with identical diagnostics.
npm install -D tsrs
SVN_ENGINE=tsrs npx svelte-check-native --workspace .It uses its own pinned TypeScript version, so results can differ from your installed version. Supported platforms: macOS arm64 and Linux x64/arm64 (glibc and musl). Selection is explicit; a missing tsrs installation fails without falling back. TSGO_BIN takes precedence.
The project targets parity with svelte-check diagnostics and CLI behavior. It is a command-line checker; editor integration and formatting are outside its scope.
| Feature or flag | Behavior |
|---|---|
| Svelte 4 and Svelte 5 | Supported, including SvelteKit projects. |
| TypeScript engine | Native TypeScript 7.0, 7.1 nightlies, or the native preview; --tsgo is accepted for compatibility. |
| Svelte warnings | Native Rust pass by default. Use --svelte-warnings bridge to run your installed svelte/compiler. |
--watch, --preserveWatchOutput |
Unsupported. Use an external watcher such as watchexec. |
--no-tsconfig |
Unsupported. A tsconfig or jsconfig is required. |
--diagnostic-sources css |
Accepted, but CSS language-service diagnostics are not bundled. |
--incremental |
Opt-in, as in upstream. See cache troubleshooting. |
Run npx svelte-check-native --help for the full CLI reference.
| Code | Meaning |
|---|---|
0 |
No errors, and no warnings when --fail-on-warnings is set. |
1 |
Errors found, warnings with --fail-on-warnings, or the TypeScript compiler was missing or did not complete. |
2 |
Invocation error, such as an invalid flag or missing tsconfig. |
| Flag | Purpose |
|---|---|
--svelte-warnings <native|bridge> |
Select the native warning pass (default) or the JavaScript compiler bridge. |
--timings |
Show wall-clock timings for each phase. |
--debug-paths |
Print resolved compiler and runtime paths, then exit. |
--tsgo-version |
Print the resolved compiler path and version, then exit. |
--tsgo-diagnostics |
Print compiler performance and memory statistics. |
--emit-ts |
Print the generated TypeScript for each file, then exit. |
--include-suggestions |
Include unused-code and deprecation hints, hidden by default. |
--disable-enhance |
Disable additional checks that intentionally differ from upstream tsgo mode, such as missing .svelte imports. |
| Variable | Purpose |
|---|---|
TSGO_BIN |
Override compiler discovery with an absolute path to a native tsc/tsgo binary or JavaScript wrapper. Takes precedence over SVN_ENGINE. |
SVN_ENGINE=tsrs |
Opt into the tsrs engine. |
SVN_BRIDGE_WORKERS |
Set the svelte/compiler worker count. Defaults to half the cores, capped at 8; uses performance-core count on Apple Silicon. |
SVN_DISABLE_ENHANCE |
Disable the additional checks described under --disable-enhance. |
CLAUDECODE=1 |
Default to machine output when running from Claude Code, matching upstream. |
NO_COLOR / FORCE_COLOR |
Disable or force colored output. |
svelte-check-native's linux-arm64 binary is static, so it installs
and runs on Android too. TypeScript 7 doesn't publish an Android
build, so npm skips its native compiler there. Its linux-arm64 build
runs fine on Android; install it explicitly:
npm i -D --force @typescript/typescript-linux-arm64@<your typescript version>Or point TSGO_BIN at any Linux arm64 tsc/tsgo binary.
Inspect the resolved paths and version:
npx svelte-check-native --debug-paths
npx svelte-check-native --tsgo-versionInstall typescript 7+ or @typescript/native-preview in your project, or set TSGO_BIN when the compiler lives elsewhere in a monorepo.
Clear the cache and rerun:
rm -rf node_modules/.cache/svelte-check-native
npm run checkThe compiler's tsbuildinfo can retain stale results. Runs without --incremental (the default) do not read it.
If this comes from your own types, check for a UnionToRecord<T> that round-trips through UnionToTuple<T>[number]. Iterating T directly in the mapped-type key can avoid the issue.
The Rust CLI parses and analyzes Svelte files, generates a TypeScript overlay, invokes the selected native compiler, and maps diagnostics back to the original source. Svelte warnings come from the native lint pass or an optional JavaScript compiler bridge.
| Crate | Responsibility |
|---|---|
parser |
Parse Svelte source into an AST. |
analyze |
Analyze runes, props, events, bindings, and scope. |
emit |
Generate the TypeScript overlay and rewrite imports. |
svn-lint |
Produce Svelte compiler warnings in Rust. |
svelte-compiler |
Bridge to the project's svelte/compiler through persistent Bun/Node workers. |
typecheck |
Manage the overlay, compiler invocation, incremental cache, and diagnostic mapping. |
enhance |
Add checks beyond upstream tsgo mode. |
core |
Share spans, diagnostics, position maps, and tsconfig types. |
cli |
Handle flags, file discovery, output, and exit codes. |
See CONTRIBUTING.md for setup, tests, and parity requirements, and the changelog for release history.
CSS language-service diagnostics remain on the roadmap.
svelte2tsx/svelte-check— transpiler + CLI whose output shape and flags we match. The.v5fixture corpus fromsvelte2tsxis our parity gate.- TypeScript 7 — the native compiler that does the actual type-checking.
- tsrs — Rust port of the TypeScript 7 checker, supported as an opt-in engine.
