Can TS be compiled directly to WASM? I don't think WASM and JS are 1:1 compatible, but I'm out of my depth here.
"MakeCode Languages: Blocks, Static TypeScript and Static Python"
It is very hard to generate good AOT code when dealing with dynamic languages, of any kind.