Comment by hliyan
3 years ago
This is one of the reasons I find it hard to like TypeScript. Despite proclamations about reducing errors and maintainability, I have seen many developers largely motivated to introduce TypeScript for no reason other than the ability to hit "." and see what comes next. While that is a good goal, transmogrifying a type system (and a rather weak one at that) into an IntelliSense annotation mechanism seems excessive.
It's comments like this that make me feel better about my own decisions.
Because if that was the only benefit typescript had, it would be a win. I mean that was the whole point with JSDOC.
Anything that shortens the feedback loop from writing the code to seeing if it works is a win.
This is the equivalent of saying, "I see many people switching jobs for no reason other than to make more money". Like... That's the not the only reason but it's a big one.
Then you get into algebraic data types, and encoding logic constraints into the type system, and you can make entire classes of bugs impossible to write.
Type systems are about safety and productivity.
Do you have an alternative suggestion? Because the ability to type "." and see what comes next, go-to-definition, find all references, rename symbol, etc. are all enormous time savers.
Just as yanis_t said, they're easily worth it even if you ignore the significant bug reduction (approximately 15%).
I don't know of any other way to get that kind of productivity boost. What would you suggest instead?
VSCode and other IDEs can do . completion, go to def, rename, etc on plain JavaScript. That's not a unique feature of typed languages.
But find all references doesn't actually work without typescript if your data is passed around enough, and that's an important one for refactoring.
No they don't. They can make a decent guess occasionally but it's not remotely the same as in typed languages where it's accurate and works all the time.
It is absolutely a unique feature of typed languages.
In far fewer cases.
Why do you think the type system is weak? I was using PureScript (Haskell derivative) prior to TypeScript, and I have found its typing capabilities to be very impressive.
I think maybe by "weak", the GC is referring to how the guarantees of TypeScript are not very "strong", i.e. TypeScript is not a "sound" type system.
I’m the sense that it allows any types and incremental adoption?