Skip to content

Experimental TypeScript to JavaScript transformer in AssemblyScript based on Sucrase

License

Notifications You must be signed in to change notification settings

acutmore/type-off

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Experimental TypeScript to JavaScript transformer in AssemblyScript based on Sucrase

Resources

License

Stars

Watchers

Forks