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.
- First: What is TypeScript, and what is it useful for?
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 a certain type and then use it differently. This means TypeScript makes you a (slightly) better coder. It also makes your development tools better development tools: adding constraints helps your tools better guess what you are trying to do and therefore help 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.
Now I'm not trying to start any flamewars here. In fact, given the StackOverflow results, I'm not saying anything revolutionary.