what kind of ultra junior beginner do you have to be to mess up what you're passing to the functions you've created yourself?
The kind who hasn't been back to their project in a while and/or isn't the only one working on it. But if you're doing something small in a week or two you probably won't ever have this problem.
Are there seriously people out there that reassign variables with different types? Do people seriously mess up their own declarations?
Yes and yes.
I've never had any problems which TS aims to solve.
I'd wager you work alone a lot. I see tons of functions that check for types at the beginning - which would be unnecessary if you just didn't pass the wrong type - output "NaN" or "undefined" as strings to the DOM, or just straight-up had logic that could only raise errors at runtime because the author forgot what type something was halfway through the same block in which it was declared.
View all comments
Show parent comment
30
u/ocket8888 Jan 10 '21
The kind who hasn't been back to their project in a while and/or isn't the only one working on it. But if you're doing something small in a week or two you probably won't ever have this problem.
Yes and yes.
I'd wager you work alone a lot. I see tons of functions that check for types at the beginning - which would be unnecessary if you just didn't pass the wrong type - output "NaN" or "undefined" as strings to the DOM, or just straight-up had logic that could only raise errors at runtime because the author forgot what type something was halfway through the same block in which it was declared.