Do I Need to Learn Typescript?
Do I Need to Learn Typescript?

Hello and welcome back to the channel. In this video I want to talk about why it's so important to learn Typescript nowadays. So let's jump right into it.

So what is Typescript? It's the most popular static typed language that transpiles in Javascript. It's actually not a completely another language as Javascript but an extension to it. It adds to Javascript the most needed missing part. And it's data types.


Javascript by itself is dynamically typed language which means that it doesn't check anything until getting an error in runtime, you can concatenate different data types and do things easy way. And this is exactly why Javascript is so popular. Because it's so easy to start. You just write something and it works. And it is all fine and good until you start to develop medium or big applications.


So here are things that are better with types than without:
- It's just difficult to understand and support the code. Because you don't describe your data in types. You just have string, number, boolean, arrays, objects. Normally we store entities inside objects but we can't really define or reuse them. We can't define and validate that this is for example User entity and it must have such properties or methods. This things makes to maintain projects easier and this is exactly what Typescript can do for us.
- Secondly is much better to get error in compiling type and not in runtime because it's already too late. This is what we are getting in Typescript out of the box. It doesn't mean that we will never get runtime error but lot's of errors we will catch earlier in compiling stage.


Also you shouldn't think that by learning Typescript you need to throw away your Javascript knowledge and learn completely new language. It's an extension to Javascript so you just need to extend you knowledge of Javascript by adding Typings to it.


Also Typescript can't be run directly in browser this is why we need to transpile Typescript code to Javascript. So you might think of Typescript a bit like about Babel where we are getting new Javascript features before that appear in all browsers.


Also as it's a superset of Javascript you can use them both simultaneously in one project or migrate your project file by file until you are completely switched to Typescript. So it's more about improving and enhancing your code then just to rewrite it in new language.


Now the question is if you need to spend time to learn Typescript. I would say if you know Javascript already you should for sure learn Typescript. It is used in huge amount of companies nowadays and even understanding Typescript on some level can be a plus for you in getting a job.


Also it helps you in writing better code even without Typescript because you start plan your applications in entities and types and not just a a bunch of variables that are working somehow together.

I hope that now you know what is Typescript and why you need to learn it

Also if you want to improve your programming skill I have lots of full courses regarding different web technologies.