TypeScript the benefits

JavaScript is a loosely typed language. I am used to with JavaScript for long. My first language was PHP and JavaScript is my second language. I started Python but didn’t continue. As all of my programming languages are loosely typed languages I am not used to with Typed language. My first impression of TypeScript was very very irritating. In the first days, Whatever I wrote is taking my focus to the type declaration from the actual logic design.

TypeScript is a superset of JavaScript. It contains all the latest JavaScript features with type hinting capabilities.

I am a Front End Developer. I work with React JS and related things which is a popular and convention-breaking ecosystem and popular with JavaScript. Recently it becomes popular with TypeScript. Surely adding type is a time-killing task but it is useful. If you are writing a maintainable software then using TypeScript is a great idea. In this post, I will try to write some point to convince you about TypeScript.

IDE Support

An IDE is a very important tool to write code. Moving/Removing files checking reference is much better if you use TypeScript. Your IDE can track down your functions and classes more accurately because of the type hinting.

Ghost Changes in the API

I see my colleagues are surviving to find ghost issue in their applications which is broken without a reason. After spending a good amount of time they found it is happening for a change in the API response which is not announced properly. This is terrific! You can write a lot of test for this may be but adding types is much easier and better.

React PropTypes replaced with TypeScript Props

If you use TypeScript you don’t need to define prop types with PropTypes. It is much easier to write it with TypeScript props.

Debugging someone else’s program

While you are refactoring or extending a program written by someone else maybe you are clicking on many functions to see how they work, what they take and what they return then TypeScript can help you a lot in that scenario. Your IDE can who more valuable information for example arguments, return values including types. It will decrease jumping to many files.

Less bug solving time

Just like debugging you have more confidence in bug solving if you are using a typed system. You are restricting more code input and output more which is effective.

Less testing with the wrong type handling

When we write some important functions we write enough test for them otherwise it might make problems to other functionalities which would be hard to track. While writing test we also try to input wrong types to let the function improve its ability and handling. If you use TypeScript you don’t need to write this kind of test anymore because TypeScript will give you a warning if there is such an issue.

Transpile to older JavaScript

Just like Babel, TypeScript can transpile code to an older version of JavaScript as your demand. You don’t need to use something else for that.

So far I am enjoying TypeScript nowadays. It is taking some time initially but paying off later. I will better spend some time while developing than finding bugs. Having a bad mood after pushing to production is not so peaceful.

Worldwide TypeScript uses is increasing. Google trend also referring to this. I live in Germany and switched my job recently. I had to attend many interviews and surprisingly I found a lot of well-reputated companies are looking for people with TypeScript skill. My current company is also using TypeScript. For your next career move TypeScript is a very essential thing to add in your CV. I hope you will enjoy writing TypeScript.