I have simple asp.net core web application, where I have installed javascript libraries using libman.
I want to use typescript, so I have installed typescript definition files for the libraries using npm, e.g:
npm install @types/jquery --save-dev
npm install @types/bootstrap --save-dev
I would like to add the .d.ts files to source control, so that other developers does not have to rely on NPM - it is the purpose of libman, isn't it?
/node_modules folder is ignored in .gitignore by default.
How do I include the typescript definition files?
Since you have installed javascript libraries using
LibMan, you could simply reuse theLibManto install the definitions too :The default path will be
libs/@types:I create a
tsconfig.jsonand configure path mapping to load modules as below :Now we can benefit from the typescript:
[Update]
For ASPNET-CORE project, the default path will be :
wwwroot/lib/@types, if we have ourtsconfig.jsonunder the project directory (next to the*.csprojproject file ), we need change the path to :