When should you start learning Typescript?

And why I say right now

Nov 30, 20223 minute read
The typescript logo

Super quick overview of what Typescript is

Typescript is simply a superset of Javascript. What does that mean? It means that all valid Javascript is also valid Typescript. You can take ANY .js file, change it to .ts, and sure enough, it will compile and run just fine. Typescript is a (technically optional) statically typed system added on top of Javascript to prevent errors, assist in debugging, and help with collaborative work as well. Once you work in a team with TS... it's very hard to go back to the wild west of JS.

typescript
let name: string = "Justin" name = 100

In Typescript, this is wrong and will give you an error. However, it will still compile and still run.

If it still runs when it's wrong, then why use it?

Obviously, you wouldn't want to use any Typescript that throws errors in your production code and with your tsconfig.json you can fine-tune just how strict it is. But that's beyond the scope of this article. The glory of still running is that if you don't know how to do something in Typescript but DO know how to do it in Javascript, then you can still do it!

This is huge when it comes to learning a new language. You can start learning by writing the same code you know and love! Any time you come to a roadblock (as you will always will) try for a while. Once you're done spinning tires on the problem (TS problem, not JS) just move on. Continue forward with learning JS. Sooner or later down the road, you'll learn how to fix it and can come back then and do it.

This helps you to stay motivated and keep building cool things that you're proud of without having to beat your head into a wall to learn static typing.

You don't (and shouldn't) have to do it alone

Zelda "its dangerous to go aline! Take this" with Stack Overflow

Another bonus of learning both TS and JS together is that you don't have to sit on a half-written program while you wait for some hero on Stack Overflow to show you create mapped types or something along those lines. You can create your question, make your sandbox or fork for them, and just keep plugging along.

Lastly, if you're in the process of learning Javascript, then I'm sure you've seen all the classes out there. And sure, there are a ton for Typescript as well, but JS has it beat 10/1. When learning Typescript you can still take these JS classes! You just need to supply the types yourself (if you can). And if you can't, then you don't. Simple as that.

So when do you start learning Typescript? Now. That's when. If you know Javascript or are learning it. Learn them both!

Share