Managing Dependencies
The simplest solution is to use a package manager like bower:
On terminal: Create an empty folder and start an empty bower repository:
$ bower init
For each definition file use this command:
$ bower install [URL] --save-dev
Example for jQuery definition file:
$ bower install https://raw.githubusercontent.com/borisyankov/DefinitelyTyped/master/jquery/jquery.d.ts --save-dev
Thanks to the bower you can use any URL here. For more information visit the bower documentation.
Compilation
Create a file (name isn't important) definitions.d.ts in the same folder where you ran the command $ bower init
.
For each installed definition file you must add manually a new line in this file:
example after adding jQuery and angularjs:
/// <reference path="jquery.d/index.ts" />
/// <reference path="angular.d/index.ts" />
Now, in your project you only need to include references to the definitions.d.ts file
Running the code
For the code to work you need the .js
files. In development environment I use the bower to manage the dependencies in a separate folder and I manually add the .js
files in html. In production use any tool to concatenate them.
TSD (TypeScript Definition manager for DefinitelyTyped)
In the near future the package manager will have option to install modules from anywhere. It's not ready, but it is a goal.
The goal of TSD future is to seamlessly support any TypeScript
definition files, from any source. By default, you should still be
able to search the definitely typed repository and install from there.
However, more focus will be trained onto support independent
definitions, specifically ones bundled with modules.
https://github.com/DefinitelyTyped/tsd/issues/150