Comment by throwaway92921
3 years ago
Gotta say I’ve tried using TS and frankly haven’t seen too much benefit. This makes me suspicious since I’m clearly in the minority about this.
I find it mildly useful as a form of documentation - and the intellisense is nice, but otherwise find it cumbersome to use.
In general - while I’ve experienced some issues with types in JS, it usually isn’t the root cause of most bugs I encounter.
Every time I say "I'm not gonna beed typescript for something this small", something happens that makes me think typescript may have been better anyway.
I agree, but I do wonder why the knee jerk reaction is "I'm not going to need it". The setup cost is basically zero! If TypeScript offers any benefit at all, why _not_ use it, since the benefits will come at near zero cost?
> since the benefits will come at near zero cost?
Maybe if you already have learned TS, otherwise there is a huge cost to learning it.
1 reply →
IMO the benefits of TS are huge, but probably the biggest benefit is that refactoring becomes almost trivial in most cases - just change the type of a variable/function/etc and the compiler will tell you every line in your codebase that needs to change in real time.
> refactoring becomes almost trivial in most cases
And when it does not become trivial, it is an indicator it would be borderline impossible without it.
After a rather extensive refactor I once did the compiler gave me over 4.000 typescript errors. It would be a tremendous effort for all of these to be identified and ironed out, probably taking years because many issues were very circumstantial.
The benefit is, your project needs a compiling phase in order to run. It's safer than just deploy and run your javascript code without that phase.