| > Type safety doesn’t seem to make a big difference. TypeScript proponents frequently talk about the benefits of type safety, but there is little evidence that type safety makes a big difference in production bug density. This is important because code review and TDD make a very big difference (40% — 80% for TDD alone)... > TypeScript is only capable of addressing a theoretical maximum of 15% of “public bugs”, where public means that the bugs survived past the implementation phase and got committed to the public repository, according to Zheng Gao and Earl T. Barr from University College London, and Christian Bird from Microsoft Research. The devil's in the details for studies like this and people ignore this to make it look like their opinion is backed up by science when it isn't. Measuring what percent help type safety gives in general is an impossibly vague concept while also very difficult to test, especially when making comparisons between numbers. From the second study for example right in the abstract: > Evaluating static type systems against public bugs, which
have survived testing and review, is conservative: it understates
their effectiveness at detecting bugs during private development,
not to mention their other benefits such as facilitating code
search/completion and serving as documentation. Despite this
uneven playing field, our central finding is that both static type
systems find an important percentage of public bugs: both Flow
0.30 and TypeScript 2.0 successfully detect 15%! 15% is a minimum from that study then and it isn't counting bugs that were caught from manual testing or otherwise before making a commit, or how much time was saved. Quoting the study in this way is incredibly misleading in my opinion. |
For me personally as a TDD person, I just don't care about testing types. I test values. The type-checker just doesn't do much that I actually care about (better in-editor support is nice though). I know it's not a fashionable answer these days, but for me it's true. I don't see the pay-off in doing both, and types alone are not enough.