Are you wondering what the fuss over TypeScript is about? And whether it is worth investing time and energy? Or whether to use it in your project? If so, you've come to the right place.
And in a way, that's strange.
What is it about TypeScript that makes it an enjoyable experience? And not just in my opinion, but in the opinion of the thousands of developers who answered the Stack Overflow developers survey and rated TypeScript the third-most loved language. (And incidentally, what does it say about our brains and how they work?)
It's counterintuitive. But we're going to explore it together.
What is TypeScript?
What does this mean?
And it is certainly one I experienced firsthand.
How does TypeScript do that? Well, that's the fundamental question, isn't it! What are the ingredients to the better development experience that TypeScript provides? What makes TypeScript fun?
That type-checking is only done at compilation time, not once the code is being run. That type-checking complains if you've said a variable was of a certain type and then used it differently. This means TypeScript makes you a (slightly) better coder. It also makes your development tools better: adding constraints helps your tools better guess what you are trying to do and, therefore, helps you get there faster.
And faster is nice as is better.
And TypeScript allowed me to use the nicer, cleaner syntax without worrying about compatibility because I could transpile the code back to the old syntax and choose the level of compatibility I wanted the TypeScript compiler to output.
What makes TypeScript a good choice to use & learn?
Now, I'm not trying to start any flamewars here. In fact, given the StackOverflow results, I'm not saying anything revolutionary.
You might be interested in learning more:
- Do you know what the differences are between types and interfaces in TypeScript?
- What are the best practices for using TypeScript in React?