-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
TypeScript Version: 3.4.0-dev.20190227
Search Terms: nested node_modules module resolution
I have a project nested inside another project. Both package.jsons import the same library, but they are two different versions of the library.
Issue
In the files inside the inner project, I am able to import something that is only exported by the version of the library used by the outer project. When I open just the inner project in VSCode, I see two entries in the import intellisense for each export from the shared library, one from each version. It appears that Typescript is recursing up the directory tree, looking for node_modules and merging their declarations even through the library is already installed in the local node_modules.
Code
Here's the import that should fail. I should only be able to import from "fp-ts/lib/HKT" here:
https://github.com/leemhenson/fp-ts-oom-repro/blob/master/subproject/user.ts#L2
Here's the inner project's import of the library:
https://github.com/leemhenson/fp-ts-oom-repro/blob/master/subproject/package.json#L7
Here's the outer project's import of the library:
https://github.com/leemhenson/fp-ts-oom-repro/blob/master/package.json#L8
I've tried settings types: [] and typeRoots, exclude: ["../node_modules"] etc.