I'm a selftaught (web) developer. On sunny days, you can find me hiking through the Teutoburg Forest, on rainy days coding or with a good fiction novel in hand.
Tbh, I don't mind either of them. I started with JS and will always use it for my personal projects, but TS has its benefits on shared codebases. Or when I come back to a project later on.
Yeah, sure, types do create overhead and ARE tedious to write.
With every con, in my opinion, there's something to be gained though.
Types in TS (or JS with JSDoc):
make my code verbose, but prevent me from reading through several layers of code abstraction
make by IDE argue every other time, thereby forcing me to think my functions and classes through
take time to write, but drastically reduce time I spend in the debugger
For team projects, there's another benefit to be gained:
Your stuff doesn't suddenly crash when another dev fiddled around or updated a NPM module with a breaking change (yes, that actually happens)
I think experts call this 'Robust Code'. I just wouldn't want to spend an hour cursing at my debugging-terminal if it can be prevented by 15 minutes of typing my module.
My editor folds away types in JSDoc, it can't do that for Typescript because - not comments... JSDoc also has documentation, not just a list of types. It's my choice
Tbh, I don't mind either of them. I started with JS and will always use it for my personal projects, but TS has its benefits on shared codebases. Or when I come back to a project later on.
Yeah, sure, types do create overhead and ARE tedious to write.
With every con, in my opinion, there's something to be gained though.
Types in TS (or JS with JSDoc):
For team projects, there's another benefit to be gained:
I think experts call this 'Robust Code'. I just wouldn't want to spend an hour cursing at my debugging-terminal if it can be prevented by 15 minutes of typing my module.
My editor folds away types in JSDoc, it can't do that for Typescript because - not comments... JSDoc also has documentation, not just a list of types. It's my choice
Typescript also has documentation typescriptlang.org/docs