Javascript (and probably by extension Typescript) are too dynamic to really compile down to machine code while still retaining all features. The best you could do would be something Cythonish where every second line gets converted to a call to PyObject_blah. It's not clear that that would actually perform better than a modern JIT engine
In which case you've just invented a less portable way of doing electron type apps.
In which case you've just invented a less portable way of doing electron type apps.