Javascript has been a very popular language. From being a scripting language that used to run in a browser to having node runtime environment has taken it to another level. At present we can build scalable website with js libraries like react
and also build cross platform mobile applications with react-native
. In the backend we can develop highly scalable api with express
and so on. That means we can do everything with javascript.
Despite of being very popular javascript has got some drawbacks. In order to overcome these Microsoft introduced an open source language named Typescript which is a superset of javascript. It has got a good number of benefits over javascript. Lets point out those in brief here.
- As ts is a superset of js, we can easily start learning ts in an existing js project. We can start by simply replacing
.js
extions to.ts
. - The main purpose of ts is
Type Safety
which means we must assign types to a data. This has made the life of every js developer easier by thousand times. Javascript has many weird functionalities and almost all of these can be eradicated by assigning scrict type to each data. - Typescript supports classes, inheritances and interfaces. This feature ease all object oriented programmers a lot.
- We can detect type errors in compile time with the help of ts. In larger projects this saves a lot of time and work. IDEs like VS Code, atom etc have excellent support of ts.
- We can use ES6 and beyond features in ts and compiler will convert it to ES5 or our required version. This means all the latest features of js are fully supported by ts.
- Day by day the popularity of ts is increasing. Tech giants are using it and the number of contributors is also increasing. This yields a large community to get support from.
- Another very big advantage of ts is that we can use it with almost all popular js frameworks and libraries. We can use it with react, react-native and also in node js development.
So without any hesitation and delay we should learn this beautiful language and bring our skillset to another level.
Happy Learning πππππ