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.

TypeScript is designed for development of large applications and transcompiles to JavaScript.[5]As TypeScript is a superset of JavaScript, any existing JavaScript programs are also valid TypeScript programs.

Typescript is a superset of Javascript which primarily provides static typing, classes and interfaces. One of the big benefits is to enable IDEs to provide a richer environment for spotting common errors as you type the code.

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.

As a Java developer and then C# I have often found JavaScript and it’s dynamic types confusing and dangerous. It does have advantages like Using Dynamic Javascript. Strong typing

The biggest problem I have is Javascript makes it hard to create classes and structure the code in logical and well thought out design. The flip side of this it’s easy and tempting to right quick messy Javascript code which is a pain to debug and maintain later. Javascript doesn’t offer much to the Developer with intellisense or code checking. This means I can often publish code with syntax errors in it!!!

The first interesting point about TypeScript is it compiles the code to JavaScript, so the end product of your CRM development will be the same e.g. a javascript file. You can almost think of it as the difference between writing early bound and late bound code. The advantages of writing early bound plugin code, is the plugin code uses the entity classes and fields. Early bound code has these advantages

Easy to read and understand

removes syntax errors

Casting and type errors are found at compile time (and not runtime by the customer)

TypeScript in my view is trying to do the same kind of standards and advantages to the JavaScript code as early bound code does to plugins.

One of the main advantages (in my opinion) is TypeScript makes it easy to create types, modules and interfaces in your code, which means the code will be more like the strong typing (C#) code. This should make it easier for developers to create well structured code and less excuses for Developer to create hacky, messy Javascript.

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

The benefit of visual studio helping autocomplete all the Out of the box Javascript functions is probably worth it alone

Xrm.Page

Xrm.Data

etc

TypeScript was created by Microsoft

Microsoft created TypeScript to help .NET developers create similar code in JavaScript as they create in .NET.

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

Hopefully I will get a bit time to have a play with TypeScript myself, I love the idea of it and think it could a great tool to write JavasScript which would be easier to understand/maintain and with the improvements with intellisense would make less sytnax, complete waste of time type mistakes, which could save a bunch of wasted time publishing Javascript files.

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

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!

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.