Limitations
tsc-rs is not a drop-in replacement for tsc yet. This page lists the differences you are most likely to meet. The conformance report puts numbers on each of them.
Type checking#
- The type checker is incomplete. It misses some diagnostics that
tscreports and reports some thattscdoes not. On the last full measurement, recall was 53.8% on the compiler suite and 60.5% on the conformance suite, and precision was 83.3% and 86.3%. - Messages and positions can differ. A whole-case diagnostic match needs every message, position and code to agree with
tsc. That holds for roughly seven in ten compiler cases and six in ten conformance cases; the conformance report has the current figures. - Unbounded type expansion. Some inputs trigger unbounded type expansion in the checker. The process caps its own address space (
TSC_RS_MAX_VMSIZE_MB, 12 GB by default) so that such a case fails instead of exhausting the machine.
Treat a clean tsc-rs run as a fast first pass, not as proof that tsc would also be clean.
Emit#
- Default JavaScript emit matches
tscfor every test case that has a JavaScript oracle. - Option variants are not all covered. With every stored option variant expanded, 93.0% of JavaScript variants pass. The failures are mostly ES5 downlevel transforms.
- Declaration emit is early.
.d.tsoutput can differ fromtsc; 88.0% of expanded declaration variants pass. - No output on type errors. When the checker reports errors, tsc-rs 0.4.1 writes no output files, where
tscemits by default. Use--transpileOnlyto emit without checking.
Project builds#
These were checked by running version 0.4.1. Projects and watch has the detail.
outDiris flat. Source subdirectories are not recreated, so relative imports between nested files break and files with the same base name overwrite each other.-bchecks but does not emit. Build mode orders and type-checks project references and writes no files.- A failed incremental build is recorded as built. Rerunning the same command after a type error reports nothing and exits 0.
- React projects. With
@types/reactinstalled, a checked build can stop on an error reported inside the type package. Use--transpileOnlyfor emit. See JSX.
Language server#
The language server passes 71.3% of the fourslash checks it is run against. The gaps are mostly type inference: hover misses come from contextual typing, generics, JSDoc type tags and cross-file aliases, and completion misses come from auto-imports and cross-file members.
Command line#
The CLI is a subset of tsc. The supported flags are listed in the CLI reference and the supported compilerOptions in tsconfig support. An option that is not listed there is not applied.
Symbols#
Symbol baselines are early: 2.9% of compiler cases and 5.2% of conformance cases match the tsc .symbols baseline.
Distribution#
- tsc-rs is built from source. The npm package
@bext-stack/tsc-rsships a prebuilt binary for Linux x64 only, and follows its own release schedule. - The WebAssembly crate is not published to npm; you build it yourself. See WebAssembly.
Reporting a difference#
If tsc-rs and tsc disagree on your code, a small reproduction is valuable. Open an issue with the input, the tsc output and the tsc-rs output.
Found a mistake on this page? Open an issue on GitHub.