Is TypeScript becoming the new standard?

by | 4 Feb 2021 | Web Expertise

Today, JavaScript and TypeScript are among the most popular languages in the development world. These two programming languages are mainly used to develop web applications, but recently, the popularity of TypeScript technology has been increasing among developers. Explanations with Thomas Delcros, senior developer at theTribe.

How would you define TypeScript?

TypeScript is an open source language created in 2012 by Microsoft, allowing static (optional) data typing. TypeScript code is transpiled into JavaScript, allowing it to be executed by any JS engine (in a browser or NodeJS server, for example). TypeScript is often defined as a "syntax extension" to JavaScript, in the sense that it increases the powers of the code by providing static data typing.

The main reason for its development is that JavaScript can show some limitations when projects last and "grow" in time as there is more and more code to manage. It becomes more and more complicated to navigate through data streams as the amount of data passing through an application increases.

The TypeScript language answers two problems that any team wishing to maintain a program faces, by adding new functionalities : 

  • How can I ensure that the data passing through my app is predictable? 
  • How can I be sure that my implementation evolves along with my data?

Why are developers using it more and more? And in your opinion, is it likely one day to surpass JavaScript? 

TypeScript is indeed a growing success with the JavaScript community for several reasons.

First, it is very incremental to learn. Since all JavaScript code is valid TypeScript code, this allows developers who have mastered JavaScript to set up the compiler in a permissive way, so that they are not blocked by all the strict TypeScript typing rules. This approach leads to easier adoption by developers, who won't feel like they have to relearn everything.

The second reason is that beyond typing the code, TypeScript allows to document the code produced, and thus facilitate its readability and understanding. It will be easier for a developer to join an existing project in TypeScript, because he will be able to quickly know what this function takes in parameter and what it returns (without having to guess, which is often the case in JavaScript).

Finally, the TypeScript ecosystem is now very mature. Many development tools ( IDEs for example) integrate extensions for the development of TypeScript applications, and will therefore offer a more advanced experience to developers (visual alerts in the code at invalid places, faster typing through data inference). The growing community also allows to bring permanent help to the problems that developers, beginners or not, may face. External libraries are increasingly written in TypeScript, which allows them to be easily integrated into applications, keeping end-to-end typing (Typescript also supports `DefinitelyTyped`, which is an open-source project aiming at typing untyped libraries).

What are the benefits for start-ups to privilege TypeScript rather than JavaSript in their projects?

The advantage of TypeScript, as mentioned above, is mostly for the developer.

The choice of TypeScript over JavaScript will make it possible to resolve certain software anomalies earlier in the development phase, and to secure the code before it goes into production. In fact, thanks to stricter rules, the TypeScript language will make it easier to manage and anticipate special cases, which the team would not have thought of spontaneously, by forcing developers to take them into account so that the code produced is valid. This saves time in the development of features, and avoids integrating bugs without realizing it in a program.

TypeScript is also very useful and efficient when it comes to code refactoring or factoring. If a code module changes its behavior, the development team will be automatically alerted, wherever this module is used and implemented. The team will therefore be more serene and secure in the redesign, thus improving the maintainability of a project over time.

As mentioned earlier, the fact that the code is more readable and easier to understand makes it easy to onboard new developers to a project, and reduces the cost of entry (which can be quite colossal on large-scale projects).

The advantage for a start-up will also be to be able to attract more experienced and rigorous developers within their company, and thus increase the quality of the applications produced and internal projects.

The image that TypeScript enjoys in the wider JavaScript ecosystem is one of quality and robustness of programs. However, this increase in quality comes with a learning cost for teams of developers who are not already familiar with it. The interest of Typescript will therefore be less if the final objective of the application is a POC (Proof of Concept), or a project of short duration.

Download the Tech Trends 2021 Guide
Florian Compain

Florian Compain

Chief Marketing Officer @theTribe

Why don't we talk?