TypeScript Definition Manager (TSD) is a package manager used to search and install TypeScript definition files directly from the community-driven DefinitelyTyped repository.
Suppose, we want to use some jQuery code in our .ts file.
$(document).ready(function() { //Your jQuery code });
Now, when we try to compile it by using tsc, it will give a compile-time error: Cannot find the name "$". So, we need to inform TypeScript compiler that "$" is belongs to jQuery. To do this, TSD comes into play. We can download jQuery Type Definition file and include it in our .ts file. Below are the steps to perform this:
First, install TSD.
$ npm install tsd -g
In TypeScript directory, create a new TypeScript project by running:
$ tsd init
Then install the definition file for jQuery.
tsd query jquery --action install
The above command will download and create a new directory containing jQuery definition file ends with ".d.ts". Now, include definition file by updating TypeScript file to point to the jQuery definition.
/// <reference path="typings/jquery/jquery.d.ts" />
$(document).ready(function() { //To Do
});
Now, compile again. This time js file will be generated without any error. Hence, the need of TSD helps us to get type definition file for the required framework.