typescript typings, whats the typings folder

9k views Asked by At

I am trying to wrap my head around typings and have the following questions

  1. What is the typings folder that you find under the node_modules root folder of the project. Is this the default place tsc looks for .d.ts files and how do I use them in the source files.
  2. Some of the node_modules contains the .d.ts files in them. Does tsc look in here by default again?
1

There are 1 answers

3
thedayturns On BEST ANSWER
  1. When you install typings with npm install @types/my-favorite-library, they are inserted by default into the @types/ folder. This is the default place for TypeScript to search for definition files.
  2. Yep, so long as you have "moduleResolution": "node", in your tsconfig.json file. This is the default value unless you have your "module" set to "amd", "System" or "ES2015".