I'm learning node.js and using Visual Studio Code. In my project I installed underscore.js. So my node_modules folder looks like this:
node_modules/
└── underscore
├── LICENSE
├── package.json
├── README.md
├── underscore.js
├── underscore-min.js
└── underscore-min.js.map
and this is my index.js file:
const _ = require('underscore');
console.log(_.contains([1, 2, 3, 4], 2));
Now, when I do Ctrl+Click on the contains
function inside index.js which in Visual Studio Code means "Go to definition", it doesn't show contains function inside node_modules/underscore.js
. Instead it opens file /home/user/.cache/typescript/2.9/node_modules/@types/underscore/index.d.ts
This is a typescript file, not javascript, and I cannot understand where does it come from? I don't think it's automatically generated from javascript file, because comments there don't exist in js file. Was it downloaded to my computer when I executed npm install underscore
? Is it possible to go to function definition in js file instead of this one (in VSCode)?