DEV Community

Cover image for 6 Reasons Why You Should Learn TypeScript in 2021
Kai
Kai

Posted on • Originally published at kais.blog

6 Reasons Why You Should Learn TypeScript in 2021

This post was originally published at kais.blog.

Let's move your learning forward together! Follow me on Twitter for your daily dose of developer tips. Thanks for reading my content!


Woah, please wait a second. You are expecting 6 reasons why you should learn TypeScript in 2021. But, did I mention that TypeScript is basically just JavaScript on steroids? So, before reading this post, you should take a look at 7 Reasons Why You Should Learn JavaScript in 2021. If you already know about JavaScript, just keep on reading.


TypeScript is JavaScript on steroids

Yeah, I've said it again. But it's true. TypeScript is a superset of JavaScript. This basically means it's a layer on top of JavaScript that adds many awesome features. So, if you know JavaScript or you'd like to learn it - you can transfer this knowledge to TypeScript. And vice versa. More or less every reason about why you should learn JavaScript in 2021, applies to TypeScript as well.


TypeScript is loved by developers

Looking at StackOverflow's Developer Survey 2020, you'll find that TypeScript is #2 of the most loved programming languages. The awesome syntax combined with JavaScript's huge ecosystem contributes to this. But, many things people hate about JavaScript don't apply to TypeScript. That makes for a really enjoyable developer experience.


TypeScript helps avoid painful bugs

JavaScript is sometimes quirky. With TypeScript's type checking system, many bugs (or features?!) are avoidable. Countless errors have occurred because you were expecting a number but a string was passed. If you are using TypeScript, this is a thing of the past. TypeScript's type system is one of the most advanced type systems you'll ever come across. And with the usage of utility types you can go even further.


TypeScript needs less code

TypeScript's language features are awesome. You'll need less code to achieve the same or even better results. The type system lets you remove many type guard clauses in your code. Also, TypeScript adds many cool features such as optional chaining (?.) and nullish coalescing (??) before they are generally available. This means you can write the JavaScript of tomorrow today.


TypeScript makes the switch easier

If you are coming from a traditional developer education, you probably have learned C# or Java. At least, those two are the dominating languages here in Germany's education system. Nevertheless, if your background involved more statically-typed languages, you'll feel much better using TypeScript instead of JavaScript. In my opinion, it felt even better than using C# and Java.


TypeScript is completely optional

Everything in TypeScript is optional. You can still write dynamically-typed code if you want to. You don't have to use interfaces, the typing system or some other awesome new language feature. Yet, those features are always available at your fingertips. Maybe some part should be statically-typed, some other part should be dynamically-typed. With TypeScript, you can. Besides, the configuration file allows you to tell the compiler how it should behave. In the end, it's still JavaScript.


Conclusion

TypeScript's popularity is on the rise. It takes the good parts of JavaScript and adds some awesome sprinkles on top. So, if you are learning a new programming language in 2021, why not try TypeScript? It might be overwhelming at first, but it's worth it in the long run. And remember, each reason why you should learn JavaScript in 2021 also applies to TypeScript.


Let's move your learning forward together! Follow me on Twitter for your daily dose of developer tips. Thanks for reading my content!

This post was originally published at kais.blog.


Cover Background Image by @joshuaearle (unsplash.com)

Top comments (8)

Collapse
 
andreidascalu profile image
Andrei Dascalu • Edited

By the same reason you should take it one step farther and learn ReasonML.
If TS is JS on steroids then Reason is JS on steroids x100. Bonus, it's made by the same guys that created React to (among other things) make up for all the bad stuff TS inherits from JS.
Also, even less code that TS (blog.dubenko.dev/typescript-vs-rea...)

Collapse
 
_danieldev profile image
Daniel Michael πŸ‘¨β€πŸ’»

Except nobody knows what reason is

Collapse
 
andreidascalu profile image
Andrei Dascalu

why "except" ? Same was true for typescript and same is true for any emergent technology. If "getting you a job" is the only reason people would learn a language, no new technology would ever appear - or ever grow.

Collapse
 
_danieldev profile image
Daniel Michael πŸ‘¨β€πŸ’»

And knowing typescript can actually get you a job, reason car get you ????

Collapse
 
polaroidkidd profile image
Daniel Einars

Oh man that looks sexy AF! I'm going to give it a spin!

Collapse
 
peter_brown_cc2f497ac1175 profile image
Peter Brown • Edited

Untill Typescript becomes the standard, it is just an extra dependancy to carry around. Learn JS well and there is no need for TS. The JS realm has WAY too many libraries. Engineers should focus on core JS and be extremely prudent in evaluating extraneous libraries.

Collapse
 
realtoughcandy profile image
RealToughCandy.io

TypeScript is awesome. (For me, it makes JS tolerable.) : ) Great post!

Collapse
 
andrewbaisden profile image
Andrew Baisden

Typescript started to become essential in 2020 so its a must learn this year. Good reminder thanks for posting.