Top JavaScript Frameworks and Topics to Learn in 2020 and the New Decade
medium.com
medium.com
Totally lost me at this line. Yes TDD and code/design review are important but a strong type system absolutely reduces an entire category of stupid bugs. It also makes sure those bugs stay fixed later on when you change a method signature and get immediate feedback on what broke. Recommending to the contrary strikes me as irresponsible and naive.
- Types are documentation most editors will allow you to click through, which makes finding definitions much easier, as opposed to just comments.
- Types are documentation that's enforced by the type checker, meaning it's always there. Either the type checker can infer it, so the editor can display it even if the developer didn't write it, or it can't, so it asks the developer to write it.
- Due to the same enforcement as above, types are documentation that never grows stale.
Add to all this the fact good editors can parse and understand this documentation, and use this and provide code suggestions, etc. and it's IMO most often a very worth investment.
It has the disadvantage of being annoyingly verbose compared to TypeScript though, so I guess the score here is:
JSDoc: Documentation that stays in sync, powers editor tooling: 1 Works with standard JS: 1 Generates better API docs: 1
TS: Documentation that stays in sync, powers editor tooling: 1 Requires compile-to-JS: 0 Less verbose than JSDoc: 1 WAY more fun to write: 1 Lacks prose descriptions for documentation: 0
JSDoc: 3 TypeScript: 3
In my experience, TypeScript does not reduce the number of tests you need to write.
Our experience is different with tests.
IMO you should use all the TDD, documentation, and code/design review in ADDITION to a type system.
Mileage can and does vary. Airbnb noted a significant benefit from TypeScript. I suspect you could reproduce Airbnb's results if you had a good design review process and poor test coverage.
Lots of people share your views. A lot of people love using TypeScript because it feels satisfying and the intellisense you get with it is really nice. I'm not saying anybody is wrong for feeling that way -- only that on the projects we used it for, ROI was not good.