This post is article-7 from the 30 Articles App series for SharePoint.
1st Oct 2012 was the day when Microsoft has released TypeScript.
It was too tempting and I could not stop myself including it in this series 🙂 !!
What is TypeScript ?
TypeScript is a language for application-scale JavaScript development.
TypeScript is a typed super-set of JavaScript that compiles to plain JavaScript.
Any browser. Any host. Any OS. Open Source.
Why Should you use TypeScript as a Microsoft Technology Developer ? :
Many people who use Dart or CoffeScript are not convinced with the idea behind creating TypeScript and there are mix responses for TypeScript in Developer Community. It makes much more sense when you believe that TypeScript is created to help Microsoft Developer Community.
You can use Visual Studio ==> familiar tool for development.
Get the Visual Studio TypeScript Plugin from here .
You can create JS code faster, robust and more manageable finally with class :P!
Advantages over simple JavaScript :
It has classes, modules, and interfaces.
It is statically typed so will provide auto-completion for statements and point out binding errors at compile time. ( very important feature for debugging + creating error free code )
I would never compare TypeScript with Dart and CoffeScript. It’s just not fair. But below is for those who compare 😉
Advantage over Dart :
Dart is written from scratch while TypeScript is build on JS. In short whatever you write in JS , you use it without any change in TypeScript.
Advantage over CoffeeScript :
CoffeeScript has its own syntax so you need to learn it while TypeScript is super-set of JS so virtually there is no learning curve.
I do quite like CoffeeScript and also see a good potential for TypeScript. TypeScript is like CoffeeScript on Steroids 🙂 .
Here is an example that for CoffeeScript you need to make sure that compiled JavaScript is actually correct .
Shall I use it for SharePoint 2013 Apps?
Of-course YES.
TypeScript can be used wherever you use JavaScript.
Remember Article-1 : There is a big NO to any server-side code for SharePoint Hosted Apps.
SharePoint hosted Apps relies on JavaScript for Cosmetics + functional Support.
SharePoint 2013 has much more improved JavaScript API which is good enough for building Apps.
I want you to explore this new product and so TypeScript will belong here in our App series..!! Do you mind?? of course not..!! 😛
Don’t forget to add Web Essentials 2012 http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6 otherwise you won’t get full TypeScript support in Visual studio.
Thanks for the new ideas ! 🙂
Just released: http://sptypescript.codeplex.com/