TypeScript/JavaScript interpreter and compiler to WebAssembly
| Object | Support Level |
|---|---|
| Object | Good - keys, values, entries, assign, defineProperty, etc. |
| Array | Good - most methods including iteration |
| String | Good - most methods |
| Number | Good |
| Math | Good |
| Function | Partial - no dynamic Function() |
| Date | Minimal - basic operations |
| RegExp | Minimal - literal parsing incomplete |
| Promise | Partial - async/await works |
| Proxy | Partial - basic traps |
| Reflect | Partial |
| JSON | Good - parse, stringify |
| console | Good - log |
| Category | Passed | Failed | Skipped | Total | Pass Rate |
|---|---|---|---|---|---|
| Math | 291 | 35 | 1 | 327 | 89.3% |
| language/statements | 6,532 | 1,230 | 763 | 8,525 | 84.1% |
| language/expressions | 5,983 | 1,701 | 2,653 | 10,337 | 77.8% |
| Boolean | 38 | 13 | 0 | 51 | 74.5% |
| Number | 249 | 84 | 2 | 335 | 74.8% |
| Promise | 459 | 180 | 0 | 639 | 71.8% |
| String | 796 | 412 | 7 | 1215 | 65.9% |
| Function | 285 | 154 | 70 | 509 | 64.9% |
| Object | 1671 | 1712 | 28 | 3411 | 49.4% |
| Date | 269 | 310 | 15 | 594 | 46.5% |
# MoonBit -> TypeScript. Run `moon info` first so pkg.generated.mbti exists.
# This creates temporary MoonBit glue code, runs `moon build --target js`,
# and emits a TypeScript package backed by the built JS output.
tsmbt --input mizchi/foo --out dist
# TypeScript -> MoonBit. For bare npm-style inputs, the runtime module spec
# defaults to the input specifier.
tsmbt --input neverthrow --out dist --direction ts-to-mbt
# File input also works; pass the runtime module when it differs from the
# declaration entry path.
tsmbt --input path/to/entry.d.ts --module-spec /runtime/module.js --out dist --direction ts-to-mbtmoon run src -- emit-typescript-scaffold-from-mbti src/pkg.generated.mbti out/ts-pkg
# optional: rewrite external MoonBit package imports to publishable TS specifiers
moon run src -- emit-typescript-scaffold-from-mbti src/pkg.generated.mbti out/ts-pkg import-rewrites.json
# opt-in: also emit top-level MoonBit wrappers for omitted root-local methods/constructors
moon run src -- emit-typescript-facade-scaffold-from-mbti src/pkg.generated.mbti out/ts-pkg# only link.js.exports JSON
moon run src -- emit-js-link-config-from-mbti src/pkg.generated.mbti
# only recursive .d.ts package
moon run src -- emit-typescript-package-from-mbti src/pkg.generated.mbti out/ts-pkg
# single .d.ts from one .mbti file without recursive rewrite
moon run src -- emit-typescript-from-mbti src/pkg.generated.mbtimoon run src -- emit-moonbit-scaffold-from-ts path/to/entry.d.ts /runtime/module.js out/moonbit-pkg# full bridge package
moon run src -- emit-moonbit-bridge-package path/to/entry.d.ts /runtime/module.js out/moonbit-pkg
# inspect generated decl/ffi/bridge snippets without writing a package
moon run src -- emit-moonbit-bridge path/to/entry.d.ts /runtime/module.js
moon run src -- emit-moonbit-js-ffi path/to/entry.d.ts /runtime/module.js
moon run src -- emit-moonbit-decl path/to/entry.d.ts# Check for errors
moon check --deny-warn
# Run tests
moon test --target native
# Verify high-level scaffold commands end-to-end
just verify-scaffolds
# Format code
moon fmt
# Run test262 (requires test262 repo in ./test262)
moon run src -- test262 test262.allowlist.txt
# Experimental AOT compilation (wasm-gc)
just experimental-aot-check # Check AOT compilability
just experimental-aot-compile # Compile fixtures to wasm
just experimental-aot-test # Run with wasmtimeInstall
Download zipTypeScript/JavaScript interpreter and compiler to WebAssembly