My dogmatic thoughts on TypeScript

Hello, my name is Andrew and I love TypeScript. In my audacious opinion, JavaScript has some glaring issues that simply can't go away. TypeScript, on the other hand, is like a breath of fresh air to almost everything I find lacking in vanilla JavaScript.

What is TypeScript?

Most importantly, TypeScript has type checking. As a superset of the language, it doesn't change anything under the hood, but it has an incredible amount to offer.

Type declarations

The 'Type' in TypeScript is exactly this. As a web developer, I come from Ruby and JavaScript land (with a dash of R). I had no idea what beauty there is when you declare a type. A computer is a lot better at keeping track of types than I ever will.

Do runtime errors even exist?: Compilation and the smart as hell linter

Real time type checking. Real. Time. Type. Checking. Failing compilation is A LOT faster than hitting runtime errors. If I try and call .slice on something I defined as a number in a different file, TypeScript will fail compilation and tell you exactly why.

TypeScript has made my JavaScript better

Your code, from an algorithmic standpoint, has to be bulletproof before it will compile. When your web app won't even load on the page until nothing could possibly cause it to break, you learn a thing or two about what it means to write safe code.

... but I don't have vanilla JavaScript (I swear)

It might sound like I hate vanilla JavaScript, but I don't. I write vanilla at work. I've come to enjoy the language, but that doesn't mean you can't criticize it.

Comments

Popular posts from this blog

Contrasting var and ES6s new declarations: let and const

Modularity vs. Abstraction. Which is More Important?

Unit testable components pt.3: Testing components