Skip to content

Type Checker ​

TypeScript compatibility

tsrs currently targets TypeScript 7.1 beta. See the compatibility status for supported features and known gaps.

tsrs is a Rust port of the TypeScript compiler and language server, incubated as part of Oxc. Cloudflare, VoidZero, and Max Schwenk are developing it in collaboration with the TypeScript team.

The goal is faster type checking and lower memory use while preserving upstream TypeScript behavior. Rust also enables WebAssembly support for running the compiler in browsers and other environments.

Quickstart ​

Install tsrs and use it as you would tsc.

sh
npm add -D tsrs
npm exec tsrs
sh
pnpm add -D tsrs
pnpm exec tsrs
sh
yarn add -D tsrs
yarn exec tsrs
sh
bun add -D tsrs
bun run tsrs

Lint and type-check with Oxlint ​

Oxlint 1.92.0 and later automatically use tsrs for type-aware linting when it is installed. Add --type-check to report TypeScript compiler diagnostics for the files Oxlint lints. The two checks share one TypeScript analysis. See the type-aware linting guide for configuration details.

sh
pnpm add -D oxlint tsrs
pnpm exec oxlint --type-aware --type-check

Use a standalone tsrs --noEmit check when CI needs diagnostics for every file in the TypeScript project, including files that Oxlint skips. Type checking in the lint run

In our type-aware linting benchmarks, Oxlint with tsrs ran up to 5× as fast as with tsgolint v7.0.2007 and used around 70% less memory. See the benchmarks in the announcement.

Fast mode ​

The standalone compiler defaults to the checker settings of the TypeScript release it ports. Pass --fast to enable adaptive checker counts, additional caches, and memory optimizations. The preset keeps compiler options such as strict and skipLibCheck as configured.

sh
pnpm exec tsrs --noEmit --fast

Fast mode can change diagnostics for programs sensitive to checking order or type-instantiation limits. Try the same command with --fast false when investigating a difference. The Oxlint backend enables fast mode by default and accepts TSRS_FAST=0 to disable it. See the performance options and benchmark results.

Use tsrs in your editor ​

tsrs includes a language server for diagnostics, completions, and navigation. On macOS and Linux, install the TypeScript Native Preview extension for VS Code and point it at the SDK from your project dependency in .vscode/settings.json.

json
{
  "js/ts.experimental.useTsgo": true,
  "js/ts.tsdk.path": "./node_modules/tsrs/tsdk"
}

For Windows and other editors, see the language server setup guide.

Troubleshoot compatibility ​

  • If your config uses legacy options such as baseUrl, check which options TypeScript 7 removed and how to migrate them. See the TypeScript migration guide.
  • Use an existing config or create tsconfig.json by hand. tsrs --init is currently unsupported. See differences from upstream TypeScript.
  • If the launcher cannot find the native binary, check that your install includes optional dependencies. See the compatibility table for supported platforms.
  • When comparing diagnostics, use TypeScript 7.1 beta at the upstream commit shown by pnpm exec tsrs --version. If the results differ, include the version, command, and a minimal reproduction in your bug report.