Hacker News new | ask | show | jobs
by GiorgioG 2687 days ago
The problem I have with TypeScript isn't the language itself, but the illusion of type safety that it gives you. It gives you a better developer experience at compile-time, there's no doubt there. My problem is once TS is transpiled, all type-related bets are off. You can easily find yourself in situations at runtime where a string is passed into to a function that's expecting a number. You may not get an actual runtime error, instead you might just see unexpected behavior. I've had to fix bugs due to this situation more times than I can count (I didn't write the original code) in our Angular app.
1 comments

That's the problem with JavaScript, not TypeScript. TypeScript doesn't eliminate that problem but it doesn't cause it either.

TypeScript does heavily mitigate that problem by verifying all the types that it can at compile time.