I recently started playing with TypeScript on an asp.net MVC web application.
We're leveraging some third party js libraries and found the type definition files over at DefinitelyTyped a huge help when dealing with libraries not originally written in TypeScript.
The first thing I tried to do was add them via NuGet and when I didn’t see them up there, I strolled to the DefinitelyTyped issues list and saw an open GitHub issue requesting the functionality.
So I took on the task. Created a PowerShell script to automate publishing and synchronize changes to the DefinitelyTyped repo up to NuGet.
This morning I pulled the trigger and published 127 different NuGet packages for each DefinitelyTyped TypeScript definitions.
As an example:
If you ran this in visual studio NuGet Package Manager console
Install-Package angularjs.TypeScript.DefinitelyTyped
You would get the following installed into your project
Note how we didn’t ask it to install jQuery? The powershell script leverages the reference path:
/// <reference path="../jquery/jquery.d.ts" />
in each TypeScript definition to help determine dependencies. We then configure the NuGet package with a dependency on the jquery DefinitelyTyped TypeScript definition package.
Happy TypeScripting!