A guide to testing tsrs, the experimental port of the TypeScript compiler in Rust: commands, compatibility limits, and precautions before integrating it into CI.
Cloudflare, VoidZero, and Max Schwenk introduced tsrs, an experimental port of the TypeScript compiler written in Rust, developed with input from the TypeScript team. The proposal aims to accelerate type checking and reduce memory usage, but it's not yet a universal replacement: there are behavioral differences and missing features. Here, we'll look at how to perform a focused test and what to review before entrusting it with a project or a pipeline.

What You Need
Prepare a project that already has a tsconfig file and an environment where you can install development dependencies. For useful results, choose a test copy or a branch that you can review without affecting your regular builds. If your team is still on TypeScript 5 or 6, the recommended approach is to first adopt Microsoft's native Go port, because tsrs follows TypeScript 7. Cloudflare's presentation and the project notes serve to verify its experimental status and limitations.
- Choose an evaluation branch and confirm that it contains the tsconfig your project normally uses.
- Install tsrs as a development dependency with the command below.
- Run the check without emitting files and save the output to compare it with tsc's.
- Review diagnostics, exit code, and script behavior before changing automated tasks.
- Test the full development workflow separately: watch mode and language server are not yet available.
Performing an Isolated Test
These are the published commands to install the tool and check the project specified by its configuration. --noEmit requests a verification without generating output. In a first pass, also keep the usual execution with tsc: the comparison helps find differences without assuming that two compilers produce exactly the same result.
npm install -D tsrs
npx tsrs -p . --noEmitDo not interpret a performance figure as a guarantee for your repository. Cloudflare reported up to eight times faster performance and about 70% less memory compared to TypeScript 7.0. Another published test measured 5.3 times faster speed and 72% less memory; when comparing with the TypeScript 7.1 beta, ImportStatic observed a smaller improvement of 2.7 times. You can review the independent benchmark and ImportStatic's comparison to understand why the reference version matters.
2 when there are type errors, while tsc returns 1; a script expecting the former value may silently fail or mishandle the result.
What to Validate Before Adopting It
Compare the diagnostics of both compilers, not just the total time. The project documentation warns that the order of diagnostics may vary, and that options like --init and --showConfig are not supported. If your process depends on any of them, the replacement will not be straightforward. A language server is also missing, so tsrs does not currently cover the complete editing experience offered by usual tools.
Collaboration with the TypeScript team does not mean that tsrs is the official compiler or that it controls the language design. According to the announcement coverage, the TypeScript team retains that control; furthermore, some optimizations identified during the work are being incorporated into TypeScript 7.1. Rust also allows exploring compilation to WebAssembly using @tsrs/wasm, but this possibility does not eliminate the compatibility limitations of the experimental project.
Our practical recommendation is to measure in a representative case, record the version, memory, and diagnostic results, and maintain a simple way to revert to the previous compiler. If type checking is a bottleneck, tsrs deserves an evaluation; if the team depends on watch mode, the language server, or scripts sensitive to the exit code, it's advisable to wait or test cautiously. The decisive figure is not the one from the announcement, but the improvement you can confirm without breaking the workflow.
Original source: infoq.com
Article generated with AI.larebelion



Publicar un comentario