TypeScript 4.0 Gives JavaScript Developers Some New Toys

TypeScript 4.0 is now available. If you use JavaScript (and a huge number of developers and technologists do), TypeScript is increasingly worth paying attention to. 

If you’re already aware of TypeScript, you know there’s a debate over whether it’s a language or not. Technically, it’s a superset of the ultra-popular and well-established JavaScript, which means that whatever you code in it is transpiled to JavaScript. However, many programming-language rankings (such as RedMonk) treat it as a full programming language, leading to many debates within the comment sections. 

Whether or not you think TypeScript should be considered a full-on programming language, it’s clear that many developers find it insanely useful. Version 4.0 adds some additional features that could boost its adoption further.

Microsoft, which developed and maintains TypeScript, issued a blog post that explains how 4.0 iterates on previous versions. New features include labeled tuple elements, speed improvements, and custom JSX factories. By the posting’s own admission, there aren’t any “major breaking changes” with this version, but these tweaks stabilize the language even more.

For those totally new to TypeScript, the posting also offers a pithy explanation for why you should consider utilizing it when working with JavaScript:

“If you’re not familiar with TypeScript, it’s a language that builds on top of JavaScript by adding syntax for static types. The idea is that by writing down the types of your values and where they’re used, you can use TypeScript to type-check your code and tell you about mistakes before you run your code (and even before saving your file). You can then use the TypeScript compiler to then strip away types from your code, and leaving you with clean, readable JavaScript that runs anywhere. Beyond checking, TypeScript also uses static types to power great editor tooling like auto-completion, code navigation, refactorings, and more. In fact, if you’ve used JavaScript in an editor like Visual Studio Code or Visual Studio, you’ve already been using an experience powered by types and TypeScript.”

The language/superset clearly has its fans. In the 2020 edition of the Stack Overflow Developer Survey, some 86.1 percent of surveyed developers said that Rust was a language they loved, followed by TypeScript (67.1 percent), Python (66.7 percent), Kotlin (62.9 percent), and Go (62.3 percent). 

“TypeScript’s surge in popularity highlights Microsoft’s change of direction and embrace of the open source movement,” Stack Overflow added. “As front-end web and Node.JS codebases grow in size and complexity, adopting TypeScript’s static typing gives developers increased confidence in their code’s correctness.”

Whether it’s a language, of course, is something you can still debate.

2 Responses to “TypeScript 4.0 Gives JavaScript Developers Some New Toys”

  1. Patrick

    “Technically, it’s a superset of the ultra-popular and well-established JavaScript, which means that whatever you code in it is transpiled to JavaScript.”

    That is not what “superset” means. A superset adds to the existing language. In this case, Typescript is JavaScript with extra stuff added. It also means that any valid JavaScript is also valid Typescript.

    Typescript is usually transpiled to JavaScript, but it doesn’t have to be. A script engine could choose to run Typescript natively without the need for it to be transpiled. GWT, CoffeeScript, Dart and many others can be transpiled to JavaScript, but they are not supersets.