One thing that has always bothered me is how difficult it is to manage data structure contracts (read: types), throughout a large amount of code. To achieve application-level fidelity, you need a specialized library, that calls for specialized object factories—breaking away from all native syntax, and making useful documentation generation and structure a miserable chore. At least, that’s what it’s been for me.
The question, for me, has always been about bridging the gap: how do I posit stronger typing into my development, if not the language? At first, I was drunk with prototypes and closures, and tried to produce my own typing/inheritance model. Its quirks and desperate lack of syntactic approximation to stronger-typed languages left me to abandon it for something else.
I use these two together often, coupled with internal definition files for jQuery, JSON, and other common libraries. The stock definition files have done a great job, so these are the only two new ones that I’ve needed, so far. (Though, now that I’m getting into KendoUI, I’d love to see definition files for it.)
So, if you want to start learning TypeScript, the best way to start is to do the following:
I find the following tweaks to Visual Studio’s options handy:
Then, you can use reference tags in your own TypeScript files, to include the definition files from above and start enjoying TypeScript in CRM 2011 development:
/// <reference path="definitions/Xrm2011.d.ts" />/// <reference path="definitions/XrmServiceToolkit.d.ts" />