HowTo manually configure typings in asp.net core app

934 Views Asked by At

I'm migrating our app from mvc 5 to asp.net core 2 (visual studio 2017.3).

In the old world we had all the typings in a folder Scripts\typings\ (for example Scripts\typings\jquery\jquery.d.ts)

and of course that's not working anymore in asp.net core. I've googled and found some posts that suggest to install the typings with npm. However npm is blocked and i can't install anything from there.

Is there a way to manually configure the typings?

UPDATE

I found out that in myapp.ts i need to add a reference to the specific typing

/// <reference path="somewhere/typings/jquery.d.ts" />

that would solve the problem. However I don't think that this is very handy, as i need jquery in all my ts files. Is there a way to add somehow do the same globally?

1

There are 1 best solutions below

0
On BEST ANSWER

You can set typeRoots compiler option in tsconfig.json file (add it if not yet included in your project).

Edited by gsharp:

that's how my tsconfig.json looks like to get my my project working. Not sure if this is the best way to configure. But it does what I expect :-)

enter image description here

{
  "compilerOptions": {
    "typeRoots": [
      "./Typings/**"

    ] 
  }
}