DEV Community


Posted on • Originally published at Medium on

All Aboard the TypeScript Train?

“If you know JavaScript, you already know TypeScript” — Anders Hejlsberg

As a fledgling developer taking flight for the first time I have found it incredibly easy to get fatigued from finding different framework or tech that I would like to dip my toes into. Part of my learning process is figuring out where to divide and invest my available time into picking up technologies not necessarily covered in the Flatiron School curriculum. As we have been tackling JavaScript in Module 3 I have been spending some time looking into industry trends with regards to JS and keep seeing “TypeScript” come up time after time. So what is TypeScript and should I devote time in my student developer journey towards it? (Spoiler alert: All signs point towards yes).

JavaScript Shortcomings

Accurate representation of my experience with JavaScript

Javascript is undoubtably incredibly popular. Github’s “State of the Octoverse report” which provides trends and insights into Github activity has consistently had JavaScript ranked as the number one most commonly used language in Github projects. However, this juggernaut popularity hasn’t stopped JavaScript from simultaneously being The Worst™️ to learn and use.

Working with JavaScript can sometimes feel like dealing with an unruly toddler in that sometimes it acts out and behaves in ways that just baffles you. For reference — Gary Bernhardt’s infamous “Wat” talk. JavaScript is a weakly typed language which often seems to translates to “loose rules which produce wild code killing errors”! JavaScript code can also fail silently and tracking down the culprit can be painstakingly time consuming.

It seems that a large opinion in the developer community is that JavaScript has so many of these delightful little quirks that additional tools such as transpilers or frameworks are needed to help developers actually use the language without tearing their hair out. That sounds about right to me considering the first version of the language that would become JavaScript was written in 10 days.

Quirks and dead horse beating memes aside, JavaScript is a dominant programming language that is used in an estimated 95.1% of all websites and is likely to hold that distinction for a while. As such, it’s important to learn the language and find tools that help the language work with you rather than against.

What is TypeScript and why should I use it?

TypeScript was developed in 2012 by a Microsoft team helmed by Anders Hejlsberg (also the lead architect of C#). This open source tool is available on GitHub and is lauded as “JavaScript that scales”. TypeScript is the solution to some of the most frustrating shortcomings of JavaScript. It is a superset of JavaScript that compiles to JavaScript meaning that it is not a new language all together (like some of it’s competitors) just an extension of JavaScript that is better suited for application scale JavaScript development. TypeScript builds on the foundation of JavaScript and fills in the cracks of a weakly typed language like Javascript. The TypeScript compiler and compiled code can be used on any browser, host or OS. TypeScript is great for catching bugs early and assisting JavaScript developers become more efficient.

  • The TypeScript transpiler has an error-checking feature which helps to highlight errors before the script is run and supports source level debugging.

  • IDE support
  • Optional type inferencing and static typing
  • Ease of coding, compiling and refactoring
  • Open source with a robust community (76,000+ questions on StackOverflow)
  • Growing industry adoption

Example TypeScript to JavaScript

Compile and Execute in Four Steps

TypeScript Takeover?

As previously mentioned, Github posts an annual “State of the Octoverse” which reports which programming languages are being most used on the website and thus are highly reflective of industry trends based on developers. TypeScript has been listed as the third fastest growing language based on survey respondents in 2018.

A particularly interesting and recent industry signifier is that Jest (a facebook developed JavaScript testing tool) is reportedly migrating from using Flow to TypeScript in their next release. Why is this significant? Flow is a facebook developed static type checker and direct competitor to TypeScript. In the conversation of rising TypeScript popularity Flow was always inevitably mentioned. It would appear that Facebook saw the writing on the wall in terms of industry tide and are looking to jump ship to the superior product.


Overview from the creator:

TypeScript documentation:

Experiment with Typescript:

Quick TypeScript overview:

TypeScript in 2019:

Discussion (1)

cubiclebuddha profile image
Cubicle Buddha

Great article and congratulations on choosing a fantastic career. I also wanted to applaud you in having lots of references in your articles. That’s something I always strive to do in my articles.

So, I’ve been using TypeScript for 2 years now and I’ve been coding professionally in Javascript for 8 years now. I’ve recently started a series of articles comparing TypeScript to various conversational techniques. I know it’s a strange sell, but maybe you’ll be interested in it. I’ve found through my career that communication is as important if not more important than technical skills.

Again, welcome and thank you for sharing a ❤️ of TypeScript.