Overview on D365 client API with DefinitelyTyped
- XrmDefinitelyTyped: In its own words “It is the TypeScript equivalent of CrmSvcUtil, but instead of generating early-bound .NET classes for server-side code, it generates TypeScript interfaces for all your client-side coding.”
- @types/xrm: This is more lightweight than the aforementioned package. It only contains the type definition required for client api with some system constants and enum values.
These 2 packages are community projects which targets to ease the development process for client-side requirements. In this article I want to share with you how to use the package @types/xrm in your project. For the package “XrmDefinitelyTyped” it has been discussed in this article.
- @types/xrm is distributed using npm package manager. The first step should be to initialize an npm package in the directory that will contain your client-side project.
- Use npm to install @types/xrm
After the installation is complete your directory should look something like this
That’s it, @types/xrm is very simple to setups and gets going. Now your client-side project is augmented with Intellisense for XRM client API which will be a massive boost for your development.
This package has deprecated properties of the XRM client API with the tag “@deprecated”. They are included in the package for they are still usable (not removed by microsoft, yet). You can manually remove these properties to keep your code up to date with the API. Updates for this package depends on contribution of the community. You can also make a pull-request to contribute a fix or update following guidance in the project’s repository.
@types/xrm is a light-weight solution for client-side development. This tool does not support connection to dynamics organization to generate entities definition. For more strict and complex usage, I reccomend that you check the other package, XrmDefinitelyTyped, out.