in Review, Uncategorized

Why you should care about typescript?

Javascript is being used to develop apps which are getting more and more complex and run on device spanning from web, mobile to PCs. Javascript (as the name suggest) is a scripting language. This means it lacks the usual constructs used to structure large application like – modules, classes and interfaces.

Also without the love of static typing developers usually face long cryptic runtime errors which are hard to understand and debug.

“Enters TypeScript.”

So what is Type Script and why should you consider using it?

On Left you see a typescript file and the corresponding javascript code on right.

1. Typescript is a superset of javascript which ultimately compiles down to javascript.

All Javascript is typescript, this means you can take your current codebase and start porting it to typescript gradually. This also provides interoperability with javascript, you don’t have to wait for some feature to be ported to typescript to use it.

Rectangle 4 + Group.png


2. Provides Constructs like classes and interfaces.

Interfaces and classes provide structure to application by letting you define concrete contracts in your code. These constructs would make many non-javascript developer feel right at home.

3. Powerful type inference provides compile time warnings and intellisense.

Typescript has a powerful type inference. This not only allows Tsc to generate type errors, but also has use in your IDE for auto-completion. Now you might be scratching you head thinking – Type Errors in javascript? Well they are Type errors in typescript, what this means is the errors are generated when you don’t follow the definitions in typescript. Even if there are errors Tsc will generate javascript code, so typescript is more of a syntactic sugar giving you the ability to find bugs in your code earlier.

4.Works with most libraries you use today.

All you need to make a library work with typescript is the definition file for the library. Don’t worry chances are somebody has already written the definition file for your library already. Definitely typed is a good source for definition files.

5.Bonus – IDE support.

Typescript has good integration with Visual Studio and Webstorm.

For the vim lovers out there, checkout these plugins –


Convinced yet? Get Started with typescript

npm install -g typescript

tsc helloworld.ts


Use extension in you favourite IDE – VS code, Atom ,Sublime text2.

If you liked the article leave a note below or get your rant on.

Write a Comment