JavaScript has been and in many ways still is the standard language of the web browser. But while it is the inevitable result of any frontend work or backend development with Node.js, it is increasingly often not the building material. Developers are turning to TypeScript as their go-to language for writing web applications. Why is it the case? What has driven so many developers away from JavaScript and into TypeScript? What’s the future of this struggle? Let’s make a side-by-side TypeScript vs JavaScript comparison.

Ever since the earliest days of the Internet, developers have always had a love-hate relationship with JavaScript. But since it is one of the three technologies (besides HTML and CSS) at the very core of the browser and web development, nobody really thought about replacing it. The efforts focus on trying to make it better. The folks at Microsoft, however, decided that JavaScript needed more motivation to work on its flaws. But did TypeScript exactly come into existence? Let’s take a step back.

JavaScript and TypeScript – the beginning

JavaScript is almost as old as the internet. Back in the 90s, out of desire to add more interactivity to the web, folks at Netscape (ancestor of Mozilla) created a new language with a Java-like syntax. This was JavaScript. In order to ensure more cooperation when it comes to standardization, they submitted it to ECMA International. The standardized version is called ECMAScript and the subsequent versions of JavaScript are its implementations.

JavaScript has become hugely popular and over time it has matured into a very capable language with tons of libraries and framework.

But the truth is that it never ceased to annoy developers.

Being weakly and dynamically typed, the code may have included at times a lot of unexpected errors. And then, there was an issue of compatibility between different browsers, which used various interpreters or even different implementations of ECMAScript altogether (Microsoft’s JScript).

Subsequent versions of ECMA attempted to solve various problems and add new features, but devs at Microsoft wanted a new solution for writing large-scale web applications faster. Their efforts led in 2012 to the release of TypeScript – a new language that can be compiled (or transcompiled) to regular JavaScript. It’s thus a superset of JavaScript, since all JavaScript code is also valid TypeScript code. At the same time, there are a lot of things that you can (directly) do only in the former.

Ecma international is a standards organization headquartered in Geneva, Switzerland

State of TypeScript 2020

Before we get into details about TypeScript, let’s just settle one thing. In terms of popularity, the efforts of Microsoft developers definitely paid off. According to the latest State of Frontend 2020 report, TypeScript couldn’t be doing better.

Not only do frontend developers believe that JavaScript will inevitably become more TS-like in the future:

… but they also flat out enjoy TypeScript better:

In addition to that, more than three quarters (!) of all study participants admitted to using TypeScript during the last year:

What problems did TypeScript set out to solve?

#typescript #javascript #web-development #programming #developer

TypeScript vs. JavaScript Comparison – Pros, Cons, Trends
2.50 GEEK