ts2rs

ts2rs is a commercial application that generates Rust WebAssembly bindings to JavaScript modules from TypeScript declarations. The Rust language is one of the best languages to use for targeting WebAssembly. One of its goals is that it Plays well with JavaScript. ts2rs helps make seamless interop a reality by generating bindings for you.

ts2rs is not yet publicly available. For product announcements, please follow https://medium.com/@taggartsoftware. If you are interested in a private preview, please email support@ctaggart.com. ts2rs will be available under monthly and yearly subscriptions. I am still figuring out the pricing and I am looking for feedback. ts2rs should help make it posssible to write some web applicatins and Node.js applications in Rust, saving hours or days or development time.

ts2rs is written in Rust and uses ts2rs generated bindings to the TypeScript API. More than a thousand lines of bindings were written by hand before I had it bootstrapped. It compiles to Web Assembly and is a packaged as a Node.js application. With access to a private NPM repository, you are able to install it with npm install @taggartsoftware/ts2rs.

Examples

Example generated bindings will be available on GitHub for a few open source projects.

Features

  • TypeScript interfaces & classes are mapped as Rust extern types.
  • The TypeScript type heirarchy is mapped to series of AsRef and Into type conversions that use JsCast to provide type safety with zero-cost.
  • TypeScript doc comments become Rust doc comments.
  • TypeScript enums are mapped as constants. The values are wrapped in newtypes.

Please create feature requests on GitHub issues or email support@ctaggart.com.

ts2rs End User License Agreement (EULA)

This EULA will be updated before the product ships. Copyright (C) 2020 Taggart Software LLC

The tenative EULA summary is:

  • Your use or installation of the software indicates you accept this license.
  • This software is owned by Taggart Software LLC and is licensed to you.
  • It is a monthly subscription. A license allows you, a single end user, access to download, install, and run the ts2rs app while the subscription is valid.
  • You may not modify this software in any way, for any reason.
  • You may not decompile it.
  • You may not defeat, nor attempt to defeat, security measures built into the software.

ts2rs Privacy Policy

ts2rs extension requires a Microsoft Account to verify the end user identity. Learn about their commitment to your privacy on their privacy page.

ts2rs Support

Issues

Generating binding is hard. Not everything will be able to be mapped. wasm-bindgen makes it easy to add additional manual bindings. Rust make it easy to adapt the types with traits. Please log bugs and other issues on GitHub issues or email support@ctaggart.com.