TypeScript

TypeScript is a new programming language launched this week by Microsoft. TypeScript is an open source JavaScript superset that adds classes, interfaces, modules, and arrow lambdas to JavaScript.

With a computer science career (or any other for that matter), it pays to pick the right technology; the one that will ultimately prevail. We invest a lot of time and energy in learning a new technology—granted it is fun—but it helps to be on target. It is easier. Companies and projects benefit as well; the development velocity increases when you pick a good technology, the approach, and business processes are simpler. Training and architecture are inherently easier. No matter the size, these matter. 

Here are, in my view, the top 10 Reasons why TypeScript will be widely adopted:

#10: Works well with existing projects
TypeScript can be easily be adopted by any project that uses JavaScript today. 

#9: Uses structural interfaces
Structural interfaces are automatically implemented by any object/prototype that complies structurally. This means that you can define an interface for existing JavaScript library as long as the object/prototype complies structurally; that is, it has the same properties and functions. It is powerful and practical.

#8: Generates JavaScript
TypeScript is compiled into Javascript to ensure compatibility. This means that it can instantly run in just about any browser—just needs to be ECMA Script 3 compliant.

#7: Great tool support
Even though TypeScript is at 0.8, there is great tool support especially in Visual Studio. Also, text editor support for Sublime Text, EMACS, Vim. Visual Studio IntelliSense is amazingly good for the TypeScript plug-in and the compiler is built-in.

#6: Simplicity
TypeScript has a simple design. The TypeScript compiler is written in TypeScript—an example of computational reflection—a beautiful thing. The C# compiler will only be implemented in itself in the next version. The typescript compiler is less than 25k physical lines of code excluding test cases and harness. Check it out the code out for yourself at CodePlex.

#5: Open Source
Microsoft has open-sourced the implementation and libraries. This is still in the best interest of Microsoft—internally they have large JavaScript projects to support Office, web properties that they own such as MSN, Windows 8 apps, etc. The code is available at CodePlex under an Apache 2 License.

#4: Anders Hejlsburg is involved
Anders Hejlsberg is a prominent Microsoft Fellow who co-designed several popular and commercially successful programming languages and development tools. He was the original author of Turbo Pascal and the chief architect of Delphi. Anders is the lead architect of C# and core developer on TypeScript.

I have admired Anders’ work since his first product: Turbo Pascal. Turbo Pascal, an amazing compiler and IDE, was written single handedly by Anders and it ran in less than 64k of memory. It was also lightning (turbo) fast. 

#3: TypeScript is a Javascript superset
TypeScript extends the JavaScript syntax. Any existing JavaScript program or library works with Typescript without a change. Existing frameworks such as JQuery and Node.js are full supported. In addition, type declarations are provided. You can also install via Node.js.

#2: Aligned with future JavaScript standards: ECMAScript 6
TypeScript is essentially an ECMAScript 6 bridge for us. Microsoft’s aim is to get the class, interface, and module constructs added to the upcoming ECMA script 6 standard.

#1: Enables programming in the large
Introduces classes, interfaces, and modules—essential ingredients for programming in the large. JavaScript has often been criticized for not allowing programming in the large. In essence, moving us back. In my view, a great developer can produce good code in any language, but it is essential to have modules and other constructs to help with large teams.

Closing
Do not necessarily jump ship from .NET and start writing all your code in TypeScript. No doubt, we all have to write JavaScript from time-to-time and TypeScript can help improve the structure of it and increase its scale. Large scale JavaScript can be necessary for Windows 8 JavaScript/HTML apps.

This week, Scott Hanselman (@shanselman) tweeted, “he who is most likely to make declarative statements is most likely be to called a fool in retrospect.” In my view, TypeScript will be widely adopted (or I am a fool). Tell me what you think?

Additional Resources
There are many ways to contribute to TypeScript: discuss the spec, write libraries, contribute to the CodePlex project, write code, submit bug reports, answer questions, learn it, provide feedback, and tell others.

TypeScript: http://www.typescriptlang.org/

Anders Hejlsberg introduction video: http://channel9.msdn.com/posts/Anders-Hejlsberg-Introducing-TypeScript

TypeScript Dart vs. TypeScript comparison by a Dart team member: http://www.reddit.com/r/programming/comments/10rkd9/welcome_to_typescript/c6g37xd

It is all about elegant code: simple yet powerful—the more the better; otherwise, much less is better. Enjoy.

Author

RBA Author

Leave a Reply