TypeScript to .NET. Rust. Mojo.

Tsonic checks TypeScript, writes native source projects, and hands them to dotnet, Cargo or Mojo.

Examples

Target
Loading examples Downloading source and generated files
0%

Compilation flow

One checked TypeScript program becomes a native source project. The native toolchain performs the final build.

Read the compiler model
  1. 01Write TypeScript
    src/App.ts
    export function add(left: number, right: number): number {
      return left + right;
    }
  2. 02Generate source
    C#double add(double left, double right)
    Rustfn add(left: f64, right: f64) -> f64
    Mojodef add(left: Float64, right: Float64) -> Float64
  3. 03Build natively
    dotnet build out/csharp cargo build --manifest-path out/rust/Cargo.toml pixi run --manifest-path out/mojo/pixi.toml build

Documentation

Guides and reference