G, your ideas are all so big.
Related: https://ostrichscript.com/
nostr:nprofile1qqs99d9qw67th0wr5xh05de4s9k0wjvnkxudkgptq8yg83vtulad30gpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5qy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsz9mhwden5te0wfjkccte9e3h2unjv4h8gtnx095szwd0k7 is also working on something similar using WASM: https://gist.github.com/Semisol/fc8747d67765fded62f2e6192e32857d
IMO, lua and wasm are better choices than typescript, since using typescript opens you up to all kinds of security issues unless you can effectively sandbox it (unless that's what you actually want).