'No intellisense ("no definition found") for local JS dependencies even though they are fully typed

Problem: When importing from node_modules in mycode.js, some modules are fully typed and intellisense is available, while others don't get that luxury.

E.g., when I press F12 with cursor on any file in src, it works.

E.g., when I press F12 with cursor on 'lodash/minBy', it also takes me to the correct type definition file (which is in a global node_modules folder for some reason, even though, I have it installed locally).

But when I press F12 with cursor on 'sigma', it complains "No definition found", as illustrated in this screenshot: enter image description here

Naturally, lodash has full typing and intellisense support, while Sigma does not.

I already changed my jsconfig.json's include settings like so, but it did not help:

{
  "compilerOptions": {
    "module": "esnext",
    "target": "esnext",
    "checkJs": false,  /* Typecheck .js files. */
    "baseUrl": "./"
  },
  "include": [
    "src",
    "src/**/*",
    "../node_modules/sigma",
    "../node_modules/sigma/**/*",
    "../node_modules/graphology",
    "../node_modules/graphology/**/*"
  ]
}

The project is a mono-repo. My paths are:

root/some-package/jsconfig.json
root/some-package/src/mycode.js
root/node_modules/{sigma,graphology,etc.}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source