Reasons Why I Choose TypeScript

One of the first and most important parts of my decision is that I have code that I had collected over the years that I would love to reuse without having to migrate or make compatible with a new language.

If you are looking for reasons why to choose TypeScript to build your JavaScript applications or just to code in JavaScript, these are my reasons why I am using TypeScript over pure JavaScript.

I Needed to Use My Existing Code Base

One of the first and most important parts of my decision is that I have code that I had collected over the years that I would love to reuse without having to migrate or make compatible with a new language. With TypeScript I can use existing code like plug and play without having to make drastic modifications.

It is Mature

Before investing time and developing using a tool, language or platform, I need to make sure that it is out of beta and future changes are not going to break anything. Right now, TypeScript is mature enough that you can feel confident developing applications with it. The language was released in October of 2012, and it is still getting more popular. In addition, I personally haven’t found a big issue upgrading from one version to another, which is very important in this always evolving web development field.

Learning Curve

I did not want to learn a new language in order to work with JavaScript. One of the reasons I never jumped into a language like CoffeeScript is that it does not feel like JavaScript, and it looks more like Ruby, which is a completely different language. I prefer spending days coding and enjoying the language than days learning a new language. In TypeScript, I just installed, and everything was compiling. TypeScript is JavaScript with few extra features that help developers to be easier. To me, TypeScript is to JavaScript as C++ is to C in the sense that if you already know the language, and TypeScript is a superset of JavaScript.

Strict Type Checking

This is a feature that you don’t think that you need it until you start using the language. I really like JavaScript because there is no type checking and it gives you the possibilities to check and make decisions depending on the type of data. This makes the JavaScript more expressive, but it turns out that I don’t need it as much as I thought. Additionally, TypeScript gives you the option to declare a variable or expect a parameter of any type using the keyword “:any”. Thus, if you really need it, it is there. But, I really like the idea of type checking because it helps you to avoid mistakes right in the code editor instead of launching the browser and realize that there is a bug in your code.

It has to be compatible with JavaScript

When I say this I mean that I don’t want to code in Python, Ruby, C# or any other language that compile to JavaScript. I think that coding in other languages to compile into JavaScript is an overkill that later we pay the price in the long run maintaining the application. Moreover, I don’t want to type something that looks like black magic or a hack from JavaScript point of view.

Great support and community

Before I learn any tool, I like to check how it is received by the community who created it, how big is its community, and what big player is supporting it and using it. TypeScript was created by Microsoft, and it is maintained by Anders Hejlsberg, which is the creator of C# and Turbo Pascal. Therefore, the language is in good hands in term of support by a large corporation and a good leader. Besides, TypeScript is well received by the community. Even Google and other big players are using it in production.

New JavaScript Features without Risks

Before browsers can implement a new feature in ECMAScript, you have the opportunity to work with it as soon as possible with TypeScript. As TypeScript compiles to JavaScript, it is easier to implement polyfills that feel transparent to developers.

It’s Supported By Modern Tools

Most of the popular IDE’s and editors have support for TypeScript. This is very important because you don’t want to move into an environment that you are not accustomed to just to program on TypeScript. Besides, popular projects like Angular and Ionic are using TypeScript. In fact, we can create applications with TypeScript and other popular open source projects like React and Vue.

Have your say