Converting Typescript to WebAssembly

Does anyone tried to use https://github.com/AssemblyScript/assemblyscript to convert a Phaser 3 game which source code is in Typescript to WebAssembly?

In affirmative case, would you mind to share your results?

I could do it myself but I only have a few very simple games and it would not proof more complez games (that use much more APIs) would work.

Regards.

I don’t think that’s possible, or you’ll have to convert the entire Phaser engine to AssemblyScript too.

I have a dumb doubt, is WebAssembly compiled TypeScript better than the javascript version of typescript?

Yes it is faster and lighter, but obviously not compatible with old browsers.

I think a port of Phaser to AssemblyScript is concevable, and it could even work with Box2D WASM instead of MatterJS for complexe physics. That’s a good project, maybe I’ll try working on it later.

Edit: maybe not lighter. I did some tests and the result .wasm files were larger than the .js ones.

Yea, some hot paths might be made faster but it won’t be lighter since WASM files also include the runtime like the AssemblyScript runtime or v8 for JavaScript.

Rust has the smallest of the runtimes so in theory having performance-critical hot paths in Rust could be faster and lighter… theoretically :smiley: