Why you need TypeScript

If you have more than 100 lines of javascript in your app, you should be using typescript. What is typescript? TypeScript is a superset of JavaScript that compiles to clean JavaScript output. It takes strongly typed object oriented code and transpile into javascript targeting whatever ECMA version you want


Today, typescript is built-in all common web editors and it is usually very easy to rebuild your typescript files. In visual studio all you need to do is actually saving the typescript file and a new version of the javascript “code-behind” file is transpiled.

Always on the current ECMA standard

Writing typescript for ECMA6, transpile to ECMA5. Using Typescript allow you to write today’s latest features of javascript, supporting the browser of yesterday.

Maintainable javascript

Your code is strongly typed, so you can safely refactor your code. When using VisualStudio, the TypeScript compiler is integrated in the built process, giving you errors and warnings about your code.

Functional & Object oriented

When I’m writing C#, I find that the language and it’s tooling allow me to easily write loosely coupled, object oriented code. In pure JavaScript, it’s a totally different thing. While you can create classes (sort-of) and JQuery filled a big gap dealing with problems we had running in different browsers, the language itself was not built to be object oriented. ECMA6 introduces classes, lambdas (Arrow functions) and everything we need to build object oriented javascript. But it’s still too early to use ECMA6 at this time.

Available libraries and TypeScript definition files

There are serveral repositories for TypeScript Typings available. That means most of the common libraries has typings available so you can start building strongly typed code over common libraries. See https://github.com/DefinitelyTyped/DefinitelyTyped . Recently, the tsd tool used to search and install typings for your application has been replaced by this project https://github.com/typings/typings.


Submit a Comment

Your email address will not be published. Required fields are marked *

Share This