I all this complication to show some clicky things on a web browser while inputting some data?
Why does your recommendation starts with "just download some other dudes code" to START a project?
These questions are obviously a means to make a point.
You can cross-compile Java and I'm not even defending Java, I used it as an example if we are going to suffer with this Rube Goldberg machine of mediocrity, then we might as well just program in Java, since it has the better tech and their package/import stuff is light years better than any TS or ES script and btw, it looks pretty much just like Java/C# now.
The JS people in charge completely lost the plot and given the nature of the industry, many software devs just started their careers with ES5/6/Typescript and don't even realize how ridiculous this whole thing is.
The problem was the misplaced "need" to make "Javascript" a "serious", best-of-breed ( ugh.. ) language to make big complicated web-apps. Given the premise and the context, of course we end with something like Typescript, which is as boring and mind numbing as Java.
How ironic it is to see the "hip" cool people at the time ending up with a mediocre copycat version of the Java world.. :)