microsoft / microsoft/TypeScript
Intellisense not working for nested npm modules in node project with typings
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
- 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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Klone das verknüpfte vscode-test-project und reproduziere das Problem, indem du containers/graphql/lib/testLib.js öffnest, nachdem du die Abhängigkeiten in containers/shared installiert hast. Untersuche das verschachtelte package.json sowie typeRoots und paths in tsconfig und vergleiche dabei die Auflösung von lodash, fs und p-memoize. Erledigt ist die Aufgabe, wenn Typdefinitionen und IntelliSense für verschachtelte npm-Module aufgelöst werden, die über das gemeinsame Container-Setup installiert wurden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- nodejs, typescript, vscode
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100