Reputation: 111
We have a monorepo and recently we decided to migrate from yarn to pnpm.
Node version: 14.20.0
pnpm version: 7.9.5
Typescript version: 4.4.2
After migrating to pnpm I updated the package manager settings in VSCode as below:
(The problem described below occurs in more that 1 apps, but for the sake of simplicity I will focus on one)
In one of the monorepo's apps we use React with TypeScript.
The problem is that VSCode does not seem to read the nested dependencies' types.
One of the app's dependencies (specified in its package.json) is react-router-dom
and react-router-dom
has react-router
as a dependency.
react-router-dom
exports the useLocation
hook from react-router
.
When I use the useLocation
hook, VSCode displays its type as
ESLint does not display any error, so it seems that it is able to follow pnpm's symlinks and read useNavigate
hook's type.
Why isn't VSCode able to properly read the nested dependency's types?
VSCode typescript version used
Upvotes: 1
Views: 2111
Reputation: 111
Turns out I had some settings in the monorepo's app's tsconfig
wrong.
To work properly, I had to update it:
Upvotes: 1