- Static type checking - The ability to find bugs at compile time using static analyzer, you can fix most static analysis errors by adding type annotations.
- Self documenting - Code is easier to read because you can rely on a value actually having the specified type.
- Better refactoring - When you change one piece of code, the type system can warn you about the other pieces of code that just broke.
- Rich editor support - Major editors like VSCode and Webstorm comes with TypeScript support built in, others through plugins. Expecting features like code completion, code snippets, auto imports, syntax highlighting, bracket matching, folding, and more.
I was very skeptical about TypeScript, I read tons of blog posts and questions on Quora and Stack Overflow. Here are my answers to TypeScript FAQs with my own perspectives after many years using it.
- Is TypeScript dead? - No! It’s very much alive and growing very fast.
- Is TypesScript worth it? - Yes! Self documentation and code completion are two main reasons TypeScript being used heavily in enterprises.
- Is TypeScript better than Flow? - Yes! Flow is fading away.
- Is TypeScript better than CoffeeScript? - Yes! CoffeeScript is fading away.
- What will be the future of TypeScript? - Very bright future ahead!
- Why do people love TypeScript? - Better developer experience.
- Why do people hate TypeScript? - Not really safe at runtime.
- TypeScript eliminates unit tests - It actually reduces the need to create unit tests which check the structure of static data received, these unit tests are tedious and can require significant effort to update when the data structure needs change.
- TypeScript eliminates runtime validation - All type annotations are stripped off at compile time, you still need to validate dynamic data to safe guard your program at runtime.
- TypeScript helps us refactor with confidence - Better refactoring is overrated, tests are something actually help us refactor with confidence.