5 ms·
No, the Go threading runtime is fundamentally incompatible with JavaScript's event-loop model. TypeScript does not define runtime semantics, JavaScript does, an
by fathyb 4y ago
No, the Go threading runtime is fundamentally incompatible with JavaScript's event-loop model. TypeScript does not define runtime semantics, JavaScript does, and it's built to run in a single-threaded environment. You cannot use it to leverage Go's coroutines unfortunately.
- karmakaze 4y agoYou can get the semantics of coroutines and no parallelism by setting GOMAXPROCS=1, either via environment variable or set in the program initialization.
- fathyb 4y agoIt would remove the benefit of running on Go. It would be less efficient than v8 + libuv because your TypeScript on Golang runtime wouldn't be as fast as v8 + JIT to run the application code which is now written in a language built for dynamic dispatch.
- alexbezhan 4y agoI don't need Javascript runtime semantics. I just want to use Typescript.