4 ms·
For ii.) Typescript is a superset of javascript. If it annoys you to try to translate JS documentation into TS, then don't. Just use the JS example and use ts-i
by _gabe_ 4y ago
For ii.) Typescript is a superset of javascript. If it annoys you to try to translate JS documentation into TS, then don't. Just use the JS example and use ts-ignore or something similar. Why throw out TS when you can literally suppress those one-off instances?
iii) You should see C++ template errors if you think the TS errors are bad. The TS errors do suck sometimes, but when I see which line of code it's complaining about, it's usually enough to clue me in to what the problem is. And once again, ts-ignore exists for a reason ;)
iv) The majority of the frameworks I use allow you to skip transpilation while developing. So you can supply the TS files directly, and then transpile when you're done.
TS has some problems sure, but these all seem like very surface level complaints that you have to deal with in any other language. Which language has dependency management solved? Or clear and concise error messages all the time? Or super fast compile times? I don't see any alternatives that don't host some or most of all of these warts.
Additionally, when I code using Javascript I feel like I'm blindly groping my way through the magical forest of dynamic code. Typescript gives me a clear and concise road map and helps me avoid a lot of traps laying around that are obscured by that dynamic magic.
Is typescript worth it? 100% yes.
- dclowd9901 4y agoThere is a big issue with “suppressing one off instances”: the truth is you’re either fully bought in or you’re not. If you have “any” types or ignores littering your code base, you don’t have type safety, and at that point, why even have typescript? There’s not _really_ any such thing as being “mostly” type safe. You could argue that “this part of my code is type safe” but if it interacts with any other part of your code that isn’t, then what’s the win?
- Dylan16807 4y agoYour code is going to run on a computer somewhere. It will never be completely safe. And many kinds of error will escape even full detailed types. Mostly safe is useful. The more you tighten types, the fewer errors can occur.