> Sure, dealing with TypeScript can be a hassle, but it is less hassle than dealing with broken software.
Can you think of examples where it's prevented broken software? I would prefer to spend more time writing good unit test coverage which in my experience would catch anything that TypeScript would have caught. I have seen it be more useful for autocomplete and self-documenting code, which I could get using JSDoc or something similar.
The biggest impact was in refactoring working code.
Being able to change something, and then have my IDE know those types elsewhere in the codebase and change them automatically, OR give me a detailed list of where things have broken, immediately, is significantly faster than tracing through failing unit tests to work out what needs to be fixed.
It's not that it couldn't be replaced entirely with unit tests - it certainly could. If that's your preference, comprehensive test coverage can be more effective than TypeScript alone. But as an online helper in the IDE pointing out where I've messed up even before running unit tests, it can make writing and iterating on correct code faster.
Piping data around an application where each step applies a transformation. It is very difficult without a type system to keep track of what the inputs and outputs are supposed to be at each step. Typescript makes this a breeze.
If your entire codebase uses static typing, you don't even need an entire class of unit tests for checking the validity of inputs/outputs to functions. You can spend that time testing business logic instead.
I know it's happened, but I find out about the error before I've run the tests, or I've used the types to guide me to the correct code rather than writing without and then testing to find out if it's correct.
The autocomplete and documentation are about preventing broken software. You just don't think about it like that because it skips the seeing it break part
Can you think of examples where it's prevented broken software? I would prefer to spend more time writing good unit test coverage which in my experience would catch anything that TypeScript would have caught. I have seen it be more useful for autocomplete and self-documenting code, which I could get using JSDoc or something similar.