tsrs README

项目的 README,来自 github.com/oxc-project/tsrs。合并为一个 markdown 文件:README.md。

tsrs

npm license

tsrs is a drop-in replacement for the TypeScript 7 compiler and language server, written in Rust. Our goal is 100% conformance, with much lower memory use and faster type checking. Read the announcement.

Get started

pnpm add -D tsrs
pnpm exec tsrs --noEmit --fast

--fast enables performance optimizations, including adaptive checker counts and additional caches. See fast mode for details.

You can try tsrs today and give us feedback on performance, memory usage, and conformance. Try checking and emitting code in the browser playground.

tsrs --fast, tsrs and TypeScript 7.1 beta: check time and peak memory by project

Conformance

We aim to release a stable version against TypeScript 7.1 with 100% conformance. See compatibility and evidence for supported features and known gaps.

Default mode preserves the pinned TypeScript compiler's checker behavior, including known diagnostic differences when checker count or file order changes. This sensitivity is inherited from TypeScript itself. See differences from pinned TypeScript for the remaining runtime differences and unsupported features.

Versioning

Versions identify the supported TypeScript release and an unpadded tsrs revision. For TypeScript 7.1.0-beta, 7.1.0-beta.tsrs1 is the first tsrs release and 7.1.0-beta.tsrs2 is the next fix. Stable TypeScript 7.1.0 uses 7.1.0-tsrs1.

SemVer compares tsrsN as text, so tsrs10 sorts before tsrs9; further sequential revisions require a new TypeScript version. These versions are tsrs prereleases, including those targeting stable TypeScript, and publish to npm's next tag (pnpm add -D tsrs@next). The compiler's TypeScript compatibility version and exact source commit remain available separately in tsrs --version and npm metadata. See versioning and releases for nightly versions and release ordering.

Fast mode

The following defaults and opt-in preset are available in 0.20.0 and later.

By default, tsrs follows the pinned TypeScript compiler's checker settings: four checkers (capped by file count), Go's file assignment and checker history. Enable the fast preset with --fast or TSRS_FAST=1:

pnpm exec tsrs --noEmit --fast
# Or enable the same preset through the environment:
TSRS_FAST=1 pnpm exec tsrs --noEmit

Fast mode adapts checker counts to the machine and project, groups related work together, and enables additional caches and memory optimizations. It keeps strict, skipLibCheck, noCheck and other checking options as configured.

See performance options for configuration, behavior and incremental-cache details.

Type-aware lint

tsrs-lint can replace tsgolint as the backend for Oxlint's type-aware rules. With --type-check, the same run also reports the type errors of the files Oxlint lints, as tsgolint does. Available in tsrs 0.23.0 and later. Oxlint 1.92.0 and later finds tsrs-lint when tsrs is installed and uses it in place of oxlint-tsgolint:

pnpm add -D oxlint tsrs
TSRS_FAST=1 pnpm exec oxlint --type-aware --type-check

Files Oxlint does not lint are not type-checked, so keep a separate tsrs --noEmit run to check whole tsconfig programs. See type checking in the lint run. The chart below was measured with tsrs 0.24.0, when --type-check checked whole tsconfig programs.

Type-aware lint plus type check on 8 cores: wall time, CPU time and peak memory of one Oxlint run with tsrs, Oxlint with tsrs plus a separate tsrs check, Oxlint with tsgolint plus tsgo, and ESLint with typescript-eslint plus tsc

Extra features

@tsrs/wasm provides WebAssembly support targeting wasm32-wasip1 (WASI Preview 1).

Learn more

Contributing

The issue tracker is open for bug reports. Please include a minimal reproduction. Pull requests remain closed because we don't have the bandwidth to review them.

See the contributing guide for building from source and running the suites, the Code of Conduct, and security policy for reporting vulnerabilities.

Acknowledgments

We thank the following organizations and contributors:

Depot      Owner.com

We extend special thanks to the TypeScript team for their support.

License

tsrs is a derivative of TypeScript (Copyright Microsoft Corporation), licensed under Apache-2.0. The bundled lib.*.d.ts files are TypeScript's. See NOTICE for attribution. Not affiliated with or endorsed by Microsoft.

tsrs (oxc-project/tsrs)

正在搜索数据库…

3.3K ·GitHub
这是什么?tsrs 是 TypeScript 7 类型检查器和语言服务器的 Rust 重写版,可作为 tsc 的即插即用替代品,目标是达到 100% 的一致性,同时大幅降低内存占用、加快类型检查速度。
tsrs 现在已经能完全替代 tsc 了吗?还没有。目前它以 microsoft/TypeScript 的 main 分支为目标,维护者计划发布一个稳定版本,与 TypeScript 7.1 对齐并实现完全一致。
我该怎么试用?最快的方式是使用浏览器 playground,无需安装任何东西即可检查和生成代码;此外还提供命令行用法、内存调优,以及本地编辑器/LSP 配置的文档。
它给出的诊断信息和 tsc/tsgo 一样吗?大体一致,但存在已知的顺序问题:tsrs 默认会对检查器的历史记录做规范化处理,因此诊断信息和跟踪输出可能与固定版本的 Go 编译器不同,具体取决于并行解析、模块解析和检查的执行顺序。若要尽量接近对比,请使用 --checkerAssignment go --noLazyMembers;另外请注意,--init 和 --showConfig 目前尚不支持。
除了命令行,我能在浏览器里运行它吗?可以。@tsrs/wasm 包会将 tsrs 编译为 WebAssembly(wasm32-wasip1 / WASI Preview 1),使其既能在 Node 中运行,也能在浏览器中运行,包括官方 playground。
许可证是怎么回事?tsrs 是 Microsoft TypeScript 的衍生作品,采用 Apache-2.0 许可证,其中包括随附的 lib.d.ts 文件;它明确声明与微软没有隶属关系,也未获得微软的认可或背书。
有哪些类似的项目?ts-rust, english-rs, ondine, liteparse, mitex, scriptc, ps2-web-recomp, oxc
大小
48.3 MB
星标
3.3K
时长
1个月
提交 · 90 天