TypeScript

Languages and frameworks | adopt

TypeScript is a programming language developed by Microsoft that adds static typing to JavaScript. Over the years it has become more and more popular and now most of the frameworks and libraries like React or Vue.js offer great TypeScript support by default.

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.

Revisions:

adopt | July 2019

TypeScript is an open source language, a superset of JavaScript. TypeScript compiler can transpile the code to various versions of ECMAScript, starting from ES3. This helps new features introduced in newer versions of ECMAScript to work in older browsers, without writing extra polyfills.

It brings new features such as:

  • Optional static typing;
  • Generic types;
  • Type definitions (*.d.ts) which adds type hints to Javascript libraries;
  • Interfaces;
  • Namespaces.

TypeScript works well both in a browser and with Node.js. It is the default language in the Angular framework. We at Kiwee choose TypeScript for the majority of Javascript projects, because it increases productivity and code reliability.

adopt