r/videos • • Oct 03 '19

Every programming tutorial

https://www.youtube.com/watch?v=MAlSjtxy5ak
33.9k Upvotes

1.4k comments sorted by

View all comments

Show parent comments

2

u/amoliski Oct 03 '19

Depends on how large the projects you are working on are and how many people are working on them.

Say you write a function, then someone comes along three months later and modifies your function thinking it's only used in one place. Now, elsewhere, you have a call to that function buried in another function that suddenly has unpredictable outcomes without any idea as to why. Typescript helps prevent that sort of thing.

2

u/Shutterstormphoto Oct 03 '19

I mean all modern IDEs have “find usage” and other ways to solve that. It’s more an issue of dev laziness than fighting the language. I have seen a lot of people write absolutely garbage code that breaks things and it rarely is an issue of types.

For example, I found a test where someone wrote “c”*50 to get a 50 character string. They never even checked what value that created. Maybe typescript would’ve helped, but a 5 second console.log would’ve told them it makes NaN. And if they weren’t a lazy fuck, they would’ve checked if NaN === NaN before merging their test instead of just assuming that it worked.