I prodded CRM MVP Dave Berry with a twitter stick, berating him to start blogging again, this is dangerous because he is a CRM Super Hero
You should read his CRM MVP Q&A, it’s very funny and interesting
Th reason I was prompting him because I was reminded of his great blog posts because I was reading a blog post from Guido Preite who wrote an excellent blog entry – Entity.GetAttributeValue<T> and ActivityParty, This is a great blog post from Guido and I would recommend all CRM Developers to read it (and subscribe to his blog).
In the blog he links to a Dave Berry blog post explaining Entity.GetAttributeValue.
This prompted me to tweet Dave Berry and he said he was doing some work on TypeScript and CRM.
What is TypeScript
Lets start with Wiki Definition
Stackoverflow has a good discussion
It’s still early days, but to get an idea of what I mean, watch Microsoft’s introductory video on the language.
It is open source, but you only get the clever Intellisense as you type if you use Microsoft’s Visual Studio (also noted in blog post from Miguel de Icaza).
This site has a bunch of samples, handbook and tutorials and is probably a good place to start.
Good articles on TypeScript
Some great resources for learning type script
Hosk Thoughts on TypeScript
I will add I haven’t used TypeScript yet, so I’m just basing my thoughts on what I have read, whilst writing this article. If you do want to get started using TypeScript with CRM, Dave’s article TypeScript, CRM 2011, and You is probably the best place to start.
- Easy to read and understand
- removes syntax errors
- Casting and type errors are found at compile time (and not runtime by the customer)
Auto Complete/Intellisense improvements
Reading the http://www.typescriptlang.org/ page, another benefit is with strong typing (read this wiki article about strong and weak typing) is you can get visual studio tools/development tools to help with best practices, static checking and code re-factoring of the TypeScript code. I understand this to mean it’s like writing plugins using early bound code, with Visual studio helping you easily select fields (defined in your entities file) and refactoring and check your code for best practices with tools like ReSharper and FXCop
TypeScript was created by Microsoft
CRM and TypeScript
There isn’t currently lots of resources or examples of TypeScript and CRM, I’m not suprised by this because until Dave mentioned I hadn’t really heard much about it.
Before you start creating any TypeScript I think I would start with the article written by Dave Berry
The blog post was from May 2013, so it will be a bit out of date (I’m guessing) but Dave has put these advantages of learning TypeScript
- Types! (If that wasn’t the first thing on this list, I should be soundly questioned.)
- C#’s interface and inheritance model! (Multiple inheritance isn’t supported, but multiple interfaces are. My C++ days are calling, and I let it go to voicemail. I’m ok with this model.)
- Generics! (…coming in TypeScript 0.9)
There is a good CRM 2013 blog post (split in 2) on TypeScript, which is simple and straight forward and a great place to start learning to use TypeScript
TypeScript and Dynamics CRM 2013 – Part 1
TypeScript and Dynamics CRM 2013 – Part 2
The CRM2013 definition file is on GitHub (https://github.com/sduck/Crm2013TypeScript)
There are three blog posts I found on CRM 2011 and TypeScript
To use TypeScript you need a definition file and for CRM 2011 you can find it
This was my first look at TypeScript and the next step is to get my hands dirty and dive in.
If anyone else has any experience using TypeScript please leave a link to your experiences/blog post in the comments
Hosk! Thanks for the mentions! Here’s a TypeScript Definition file you might find to your liking, as it’s the one I’m using with every project these days: https://github.com/6ix4our/DefinitelyTyped/tree/master/xrm
As you can see, I’m trying to get it folded into the DefinitelyTyped project, but they won’t accept it without a “tests” file to accompany it. I’ve been busy enough with project work, that I might not get around to that until January, but if you want to pitch in, you’re more than welcome!
Hosk, here is the TypeScript Definitions for Microsoft Dynamics CRM 2015 https://www.nuget.org/packages/xrm-2015.TypeScript.DefinitelyTyped/ based on Xrm2011Typescript project on codeplex.com
hi!,I love your wrkting very much! percentage we keep up a correspondence extra about your article on AOL?
I need aan expert on thi area too solve my problem. May be that is you!
Looking ahead to look you.