3 ms·
I worked many years before TS too and happened to have been working on very neat codebases back then, though I did have the luck of working with a really talent
by roberttod 4y ago
I worked many years before TS too and happened to have been working on very neat codebases back then, though I did have the luck of working with a really talented set of people.
I conceed that perhaps you are correct about this - it does force people to write less strange code. JS gives you so much freedom that if you don't keep it simple you can really hang yourself. However if you put care into your code and keep it simple, I don't think TS helps all that much.
There have also been situations where I have had to do something a little bit strange, and TypeScript made it an absolute mess. And if you do enough JS you'll know that sometimes you do need to write a function that needs to leverage dynamic typing pretty hard, even if it's quite rare.
- atom_arranger 4y agoIMO TypeScript nudges you away from bad patterns. If it’s a mess to type it, it’s probably a mess in general. If you are in a very rare situation and think you know better then there’s “any”, although at that point you really need to think “I’m risking runtime errors and this code is confusing, is it worth it or is there another way?”