Why use TypeScript?

Maximiliano Tomassi · Front-end Engineer 2021-10-12 · 5 min read

TypeScript is an open source programming language developed by Microsoft in 2012.

Superset of JavaScript

It is a superset of JavaScript, which adds static types and class-based objects. Basically, it is JavaScript with some added values. In the end, Typescript transpiles to JavaScript.

It has a great acceptance within the community, being one of the most valued languages ​​in the prestigious annual Stackoverflow survey.

It has the ability to detect errors at compile time, that way you will write reliable code and will be able to mitigate the shortcomings of JavaScript. It’s an amazing fact about learning what TypeScript is.

As browsers do not understand TypeScript, it is necessary to transpile it to JavaScript before using it. TypeScript can be transpired into any variant of JavaScript / ECMAScript that we want. For example, if we know that our project will work in old browsers, we can force it to compile to ECMAScript 5 (the classic JavaScript). However, if we are clear that users are going to use relatively recent browsers, we can generate a simpler final code supported by ECMAScript 6 or a later version.

It works well with Front-End libraries and frameworks you may be using. Some of them, like Angular, Ember or Aurelia take special advantage of it, and even the combined use of TypeScript + React is becoming the norm.

The main characteristics of TypeScript are:

  • It is a strongly typed language. In other words, "let str: string =" Hello "" will indicate an error if we change to a type other than string.
  • It supports type inference. In other words, "let str =" Hello "" is inferred from the type string.
  • It allows you to create reusable code based on generic types.
  • It allows the creation of new types in two ways: interfaces or type.
  • It allows defining enumerations and supports tuples as basic data type.
  • It allows the creation of interfaces.
  • It has decorators.


In conclusion, TypeScript is easy to learn coming from JavaScript and ends up turning it into an adult language comparable in many ways with Java or C #.

In medium or large projects, and especially if several people are involved in them, writing the code in TypeScript offers great advantages. It avoids innumerable typical errors of non-typed programming and at the same time allows creating standardized code throughout the work team.

Keywords: typescript, javascript, tool