In our experience, using TypeScript provides many benefits.
Type checking This is the reason why TypeScript was created, it helps to identify errors related to type mismatches before the code is run. Without TypeScript, these types of errors will often not result in any critical errors at first: then can be easily overlooked and land on production.
Code clarity The code is much easier to understand with TypeScript. This is especially noticeable when there are more people working on the project, or when a new developer joins. When analyzing some processing functions that operate on complex data structures you can just check what types (interfaces) are used to understand the exact format of input and output. The same applies when working with React components, with TypeScript it’s obvious what kind of properties are expected by the component.
Improved code completion As you write, you will be provided with the available fields and methods of a given class. This helps you save time—instead of inspecting the class source to find what is the exact method name.
We put TypeScript in the “adopt” ring. In our opinion, there is simply no reason not to use TypeScript—especially since it is supported by many frameworks and libraries by default.
It brings new features such as:
- Optional static typing;
- Generic types;