What is the “right” way to define DefitelyTyped typescript definition files in a .net kernel project?

In asp.net for .net, I used nuget to import w870> type names from third-party libraries. ( *.d.ts ) These packages are from DefinitelyTyped . I understand that in the new world of the .net kernel, nuget is no longer intended for use in net.net assemblies.

So, is there a good way to define typescript in an mvc project? Right now, I'm heading to the github repository and downloading the ones I need manually using a web browser. There must be a better way.

+5
source share
1 answer

Are you using TypeScript 2.0? If so, try following the instructions here: http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html . Basically, there are "special" npm packages that you can install with types.

If you are not using TypeScript 2.0, do you use Gulp to compile TS code? If so, you can simply do:

 var typings = require("gulp-typings"); gulp.task("typings", function () { return gulp.src("./typings.json") .pipe(typings()); }); 

This will put all the typings you specify in the typings.json file into the / typings folder.

If you use grunt instead, there is an npm runch-typings package, and I'm sure you can find similar packages for other build runners.

+1
source

All Articles