https://blog.acolyer.org/2017/09/19/to-type-or-not-to-type-quantifying-detectable-bugs-in-javascript…
Robbie Coomber
1

I’m aware of this research, and the data is very interesting and useful. However, the reading of the data and conclusions are nonsense.

What the data actually says NOT that static types reduce bug density by 15% (that’s not what was studied), but that 85% of bugs are not even adressable by static type checking.

Only 15% of bugs in the studied code bases are even addressable by static type checking using TypeScript or Flow.

In practice, the number that actually gets addressed in real code bases will be lower than 15% (and in the data I’ve seen on this topic, the impact is statistically measurable, but small).

In the meantime, employing TDD actually reduces production bug density by 40% — 80% in practice.

Both static types and TDD can be beneficial. If I could only pick one for bug reduction, I’d pick TDD, hands down.

Luckily, we don’t have to choose one or the other. We can use both. Whether you use static types or not, you should definitely be using TDD. ☺