microsoft / microsoft/TypeScript
Intellisense not working for nested npm modules in node project with typings
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
- VSCode Version: 1.48.0
- Node.js: 12.8.1
- OS Version: Windows_NT x64 10.0.18362
Steps to Reproduce:
- Git clone project from https://github.com/owenallenaz/vscode-test-project .
- Open project root folder in vscode .
- Go to nested containers/shared folder and npm install.
- Open containers/graphql/lib/testLib.js in vscode.
- Type hinting will exist for
fsbut not forlodasheven though both are installed via their respective @types. Type hinting will work forp-memoize, but that project uses embedded d.ts files within the npm package itself, not provided via @types.
If you move the package.json down to the root of the project and delete typeRoots and paths, then the type hinting works perfect. The interesting thing you will note is that lodash will be listed as a found module. In example if you remove the "paths" block from tsconfig, then you will get the red squiggly under lodash. In addition, if you remove @types/node from package.json and npm install, you will find that the fs will no longer have type hinting. So the @types modules are working... but some aren't. I have observed this behavior for nearly every npm module I've tried, be it mongodb, express, lodash, none of them receive type hinting in this setup.
For technical reasons I cannot move the package.json to the project root because it's a multi-container Kubernetes project and the shared container does all of the NPM installs for the other containers.
Does this issue occur when all extensions are disabled?: Yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Clone the linked vscode-test-project and reproduce the issue by opening containers/graphql/lib/testLib.js after installing dependencies in containers/shared. Inspect the nested package.json, tsconfig typeRoots and paths while comparing lodash, fs, and p-memoize resolution. Done means typings and IntelliSense resolve for nested npm modules installed through the shared container setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100