Installation
Build current source with Cargo to get the optional external tsrs integration. The previously released 0.4.2 native binaries and npm package predate that integration.
Requirements#
- A stable Rust toolchain with Cargo. Install it from rustup.rs.
- Git.
- On Linux x86-64 the workspace links with
clangandlld(configured in.cargo/config.toml), so install both. On Debian or Ubuntu:sudo apt install clang lld.
Build from source#
git clone https://github.com/benfavre/ts-rs.git
cd ts-rs
# Install the tsc-rs binary into ~/.cargo/bin
cargo install --path crates/tsc_rs_cli
Or build in place and use the binary from the target directory:
cargo build --release
./target/release/tsc-rs --version
The release profile uses thin LTO and a single codegen unit, so the first build takes a while. make build-fast produces a release binary without LTO when you want a shorter build.
The repository vendors the TypeScript test corpus under tests/, so the clone is large. That corpus is what makes the conformance numbers reproducible.
Optional external checker#
After building current source, run python3 scripts/install-tsrs.py, then tsc-rs --checker tsrs -p tsconfig.json. The native checker package and its declarations are installed separately; native transpilation remains independent. See platforms, memory controls and command behavior.
Check the install#
tsc-rs --version
tsc-rs --help
Prebuilt downloads#
The 0.4.2 GitHub release
includes binaries for Linux x64/ARM64, macOS Intel/Apple Silicon, and Windows x64,
plus the VS Code extension and SHA256 checksums. Verify the archive against
SHA256SUMS.txt, extract it, and put the executable on PATH.
npm#
A prebuilt Linux x64 binary is published as @bext-stack/tsc-rs:
npm install --save-dev @bext-stack/tsc-rs@0.4.2
npx tsc-rs --version
The npm package currently ships tsc-rs 0.4.2 for Linux x64. See npm package for platform support and the TSCRS_PATH override.
Editor#
To use tsc-rs in an editor, build the binary first, then follow Language server or VS Code extension.
Next#
Continue with the Quick start.
Found a mistake on this page? Open an issue on GitHub.