3 ms·
> You can also write Swift code and use another transpiler to get JavaScript code from it and you would say that JS is great. I haven't read the article yet, b
by Vinnl 9y ago
> You can also write Swift code and use another transpiler to get JavaScript code from it and you would say that JS is great.
I haven't read the article yet, but what you're saying is something completely different, in my opinion. If you write Swift you're writing a completely different language, with all the hassles usually introduced when transpiling. TypeScript, however, is just Javascript with some of the assumptions made explicit and a transpiler that actually checks whether you're violating those assumptions. In that sense, it's not much different from a linter - another tool that makes Javascript more pleasant to write.
- onra87 9y agoIn the end, you have to transpile your code to JavaScript. Whether you are writing TypeScript or Swift code. But I agree, Typescript has more similarities with JS than Swift does.
- Vinnl 9y agoThat is true, but there are a lot of risks associated with transpiling completely different languages that are not there when using TypeScript. For example, if TypeScript ever goes away, you simply transpile it to Javascript once (i.e. strip away the explicit type annotations) and continue to work on the resulting Javascript - in a different language, that would be a complete mess. Furthermore, TypeScript integrates really neatly with the rest of the Javascript ecosystem (because it's just Javascript), saving you a lot of hassle and lock-in. Reducing all that to "but it has to be transpiled to Javascript" is a simplification that doesn't help in highlighting potential concerns associated with transpilation, in my opinion.
- onra87 9y agoI totally agree with you. My point here was just to prove that you cannot sell the beauty of JavaScript syntax by saying that you have to use TypeScript :)
- Vinnl 9y agoHaha, that's true, though I guess in the context of this article that's mostly semantics, since it says that tooling (like TypeScript) is part of what makes "Javascript" great :)