Under asp.net for .net framework, I used to use nuget to import typescript type definitions 3rd party libraries. (*.d.ts
) These packages are from DefinitelyTyped. I understand in the new world of .net core, nuget is no longer intended to be used for non-.net assemblies.
So is there a good way of getting typescript definitions into an mvc project? Right now, I'm going to the github repo, and downloading the ones I need manually using a web browser. There has to be a better way.
Are you using TypeScript 2.0? If so, try to follow the instructions here: http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html. Basically there are "special" npm packages you can install with the types.
If you're not using TypeScript 2.0, are you using Gulp to compile your 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 your typings.json file into a /typings folder.
If you're using grunt instead there is a grunt-typings npm package and I'm sure you can find similar packages for other build runners as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With