• Alpha
  • On npm: @ts-r.dev/check

ts-r-check: type checker

A type checker with tsc's command line and output format. It reports only what it is sure of; many checks are still missing.

ts-r-check type-checks a TypeScript project and prints diagnostics in tsc's format, with tsc's error codes. Like tsc, it also writes the project's JavaScript, source maps and declaration files unless noEmit is set; pass --noEmit to only check, as with tsc --noEmit.

The checker is the least finished part of ts-r. Read Status before you rely on it.

How to read its results

The checker follows one rule: no false positives first. When it meets something it doesn't implement yet, it gives that expression a silent type that is never reported. So:

  • An error from ts-r-check is very likely an error tsc reports too.
  • A clean run from ts-r-check does not mean tsc is clean. It can miss errors.

Keep tsc in CI until ts-r-check covers the features your project uses.

What works today

  • Loading the project from tsconfig.json, including extends, with tsc's config diagnostics such as TS6053.
  • Module resolution that matches tsc's: 158,174 resolutions across 114 configs of five public repos, 0 mismatches.
  • Assignability, calls and overloads, generics and inference, unions and narrowing, type operators (keyof, mapped, conditional and literal types), classes and declarations, and unused-code checks. Errors such as TS2322, TS2304, TS2307 and TS7006 print with tsc's wording.
  • tsc's output in both plain and pretty form.

Not yet

  • Octal escapes in strings (TS1487) are reported only with --no-history, not by a default run or with --noCheck. Regular expression errors don't carry tsc's "Did you mean" suggestions (TS1369).
  • Some inference: contextual types that flow through a reverse mapped type print wider than tsc's (number | T["a"] where tsc prints number).
  • Some relation and narrowing results differ from tsc's, mostly in TS2322, TS2339 and TS2345: 242 of tsc's 12,750 conformance test variants (1.9%) don't match exactly.

The full list is in ts_r_checker's notes.

Command line

usage: ts-r-check [-p tsconfig.json] [options]

--help lists every option. It accepts tsc 7's command line; the flags below are the common ones.

FlagWhat it does
-p <path>The project's tsconfig.json. Without it, the nearest tsconfig.json above the current directory (TS5058 or TS5057 when there is none).
--noEmitOnly check: write no JavaScript, source maps or declarations. Without it (and without noEmit in the tsconfig), ts-r-check writes them as tsc does; syntax it cannot lower for the target yet is reported as TSR2003.
--pretty falsePlain output: path(line,col): error TSxxxx: message, chain lines indented two spaces per level, no summary.
--threads NChecker threads. Default 4, clamped to 1 to 4.

Pretty output is the default on a terminal. It adds code frames and a Found N errors in M files. line. Paths are relative to the current directory, and output is sorted by path, then position. Config diagnostics print first.

Exit codes follow tsc:

CodeWhen
0No errors
1Errors, and --noEmit, noEmit or noEmitOnError is in effect
2Errors otherwise (tsc's "errors, outputs generated")

You can also run it through the launcher as ts-r check.

Lib files

ts-r-check needs TypeScript's lib.*.d.ts files. It looks in this order:

  1. The directory in TS_R_LIB_DIR.
  2. A lib/ directory next to the executable (or ../lib).
  3. target/upstream/typescript/tsc/internal/bundled/libs in a source checkout, after cargo xtask upstream sync --minimal.

See Getting started for the source setup.

Next to tsc

ts-r-check reads the same tsconfig.json and prints the same format, so editor problem matchers and CI annotations that parse tsc's output work unchanged. It also takes tsc's --build and --watch, and writes the same output files. Running both and comparing their output is a good way to try it; ts-r-build makes bundles.

For stricter checks than tsc's, see Sound mode.

Measured

Against tsc 7.0.2:

TestResult
tsc's conformance baselines, 12,750 compared test variants98.1% exact (all diagnostics and chains); 110 variants with a diagnostic tsc does not report, 4 of them in tests where tsc reports nothing
Six public projects: tRPC, date-fns, TypeORM, Playwright, RxJS, the React CompilerAll 6 match exactly (React Compiler: all 156; RxJS: all 21,908)
Ecosystem check stage709 packages pass, 0 fail (100%)

Some of the 220 conformance extras are runner artefacts, such as tests for module kinds tsc 7 removed, which have no baseline.

Speed on a shared GitHub-hosted ubuntu-24.04 runner (4 vCPU, 4 threads; the bench of pull request #133 on 2026-11-10, at 63756ad, merged as b748322; cargo xtask bench --repos, cold check, no history, median of 5; peak memory not measured):

Projectts-r-checktsc 7.0.2
tRPC packages/server269.8 ms589.9 ms
date-fns pkgs/core598.7 ms1,154.3 ms
RxJS packages/rxjs3,458.3 ms3,645.7 ms

On RxJS the two are close (about 1.05×, within this runner's spread inside one run), and on the same run's Linux arm64 runner tsc 7 was faster there (3,392.1 ms against 4,031.2 ms). With its saved history and nothing changed, ts-r-check took 31.7 ms on tRPC, 81.8 ms on date-fns and 62.7 ms on RxJS in that run.

An older run with two more projects and peak memory (Apple M-series shared laptop, 2026-10-16 at commit 9c3a371, median of 5, peak memory of one run):

Projectts-r-checktsc 7.0.2
tRPC packages/server108 ms, 117 MB189 ms, 294 MB
date-fns pkgs/core226 ms, 216 MB323 ms, 558 MB
RxJS packages/rxjs462 ms, 458 MB1,280 ms, 1,168 MB
TypeORM packages/typeorm548 ms, 377 MB567 ms, 826 MB
Playwright (root project)592 ms, 463 MB685 ms, 1,094 MB

With its saved history and nothing changed, ts-r-check took 23 to 126 ms on those projects. These repos don't type-check cleanly under TypeScript 7. ts-r-check reports exactly tsc's diagnostics on tRPC, date-fns, TypeORM, Playwright and RxJS (about 21,900 diagnostics; 2026-11-06, 3042fe0). ts-r also skips work it doesn't implement yet, so these numbers will move as the checker grows.

Method and commits: check on Linux, check on the laptop, ecosystem and correctness.