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.
It has a great acceptance within the community, being one of the most valued languages in the prestigious annual Stackoverflow survey.
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
- 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 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.