3 ms·
"Types don't make you write better code." I'm going to disagree with this big time. Types allow much easier refactoring. I can refactor a large TypeScript in
by zaccusl 5y ago
"Types don't make you write better code."
I'm going to disagree with this big time.
Types allow much easier refactoring. I can refactor a large TypeScript in a few hours that wouldn't even be possible in a few weeks in JavaScript.
This makes continuously improving code so much easier.
It also allows rapid iteration during development. I can change function signatures and object shapes to improve my code, and even if those functions and objects are used prolifically throughout my source, I can do the updates in a few minutes.
Compared to JavaScript where many time I'm like "this would be so much easier if this function took a different parameter and this object was required to have this field, but it would take me 12 hours to change and even then there might be places I miss."
Even competent unit testing doesn't save you from these situations.
I remember the 2015 JS conf when Douglas Crockford listed "patterns" to "help" with the aforementioned issues but really didn't do much. Then went on to say "real" developers don't need TypeScript even though TypeScript SOLVED every issue he mentioned he was trying to solve. I had to shake my head that day.