3 ms·
(1) The transpiled JavaScript closely resembles the source TS, making debugging easier (source maps allieviete this to a certain extent). (2) Transpiling from
by DrJokepu 10y ago
(1) The transpiled JavaScript closely resembles the source TS, making debugging easier (source maps allieviete this to a certain extent).
(2) Transpiling from a whole different language means you have to port the standard runtime, otherwise you'd lose portability and familiarity, which are the two key advantages of transpiling from another, widely used language. Also, as JavaScript often runs in the browser this means downloading the runtime.
(3) The more different the two languages are, the more likely you'll run into surprising situations where feature X in language Y cannot be implemented in its original form in JavaScript, causing subtle incompatibilities between Y code written for the "original" Y compiler / interpreter and Y code that was meant to be transpiled.
(4) As someone else mentioned, TS is almost a superset of JS, which means mixing in JS code into TS code is much easier.
(5) What is a real language anyway?
- wtbob 10y ago> The transpiled JavaScript closely resembles the source TS, making debugging easier (source maps allieviete this to a certain extent). High-level languages look nothing like machine code, but we still compile them to it. > Transpiling from a whole different language means you have to port the standard runtime That's true, but it's not a reason not to use a good language instead of a horrific one. > The more different the two languages are, the more likely you'll run into surprising situations where feature X in language Y cannot be implemented in its original form in JavaScript I contend that any feature of a Turing-complete language can be implemented in JavaScript. > As someone else mentioned, TS is almost a superset of JS, which means mixing in JS code into TS code is much easier. 'I still get to use JavaScript' doesn't sound very appealing. But, of course, many high-level languages offer an escape to assembler: a high-level language compiling to JavaScript can offer an escape to JavaScript. > What is a real language anyway? Haskell, CaML, Lisp, Python, Go — not JavaScript, though, which is an embarrassment to our profession.