Skip to content

What is TypeScript?

Posted on:February 18, 2019code3 min read

TypeScript is probably the best way to add static typing to JavaScript. That’s probably all that people really know about TypeScript though - that it adds static types. I like to delve a little deeper into a topic before I start to learn it, so I figured I’d take you along for the ride.

Check out the video for all the details, or read about the highlights from the video below.

It’s a strict syntactical superset of JavaScript.

Why does this matter? Because any JavaScript application automatically becomes a TypeScript application.

Anders Hejlsberg is the lead developer of TypeScript. This matters because he knows a thing or two about writing a programming language, having created C#, Delphi, and Turbo Pascal. So, he knows a thing or two about how to make a programming language.

TypeScript was first made public in October 2012, which was far earlier than I had ever imagined.

TypeScript is by no means the first static type checker for JavaScript.

Google Closure Compiler was probably one of the first ones. It was released all the way back in 2009. It’s method of adding static types was via JSDoc comments. As you annotated code with JSDoc comment blocks the Closure Compiler parsed it and imbued your code with static types. Closure Compiler is still developed and used, however mostly internally to Google.

Flowtype is another popular static type checker. Created by Facebook, it adds static type information via inline annotations (similar to TypeScript). It’s not as popular or widely used in the open source community as TypeScript.

Why TypeScript?

So we talked about what is TypeScript, but now let’s talk about why you should consider using TypeScript.

I delve into more detail in the video but here are the bullet point reasons: