type-off
type-off copied to clipboard
Experimental TypeScript to JavaScript transformer in AssemblyScript based on Sucrase
Type Off
A TypeScript to JavaScript compiler in AssemblyScript. A fork of https://github.com/alangpierce/sucrase
Findings
Converting 40K lines of TypeScript.
| Tool | Time * |
|---|---|
| esbuild | 31 ms |
| this | 318 ms |
| sucrase | 979 ms |
* times are collected from the shell. So include full time from the OS process start to exit. Device: M1 MacBook Pro.
Limitations
⚠️ Experimental. Do not use this. ⚠️
Stripped back to only remove TypeScript types, (and compile TypeScript enums into objects).
No support for classes, module transforms, JSX, Flow.
Requirements
Requires a WASI compliant WebAssembly runner to execute.
Wasmtime
cat './input.ts' | wasmtime ./build/out.wasm > './output.js'
Node.js
Node.js has (currently experimental) support. https://nodejs.org/api/wasi.html
cat './input.ts' | node --experimental-wasi-unstable-preview1 ./bench/node-wasi.js > './output.js'
Development
Node, Npm
npm install
npm run asbuild
Experiment notes
Found in ./bench/benchmarks.md