A monorepo's TS autoimport doesn't work in VSCode. microsoft/TypeScript#38923 (comment)
🚨 Look in packages/components/index.ts
. If you open this in VSCode
, you'll see that createContext
does not autoimport.
✅ Meanwhile, importing the same variable in apps/nextjs/pages/index.ts
works fine.
This is coming from @types/react
.
All variables from @types/react
should autoimport in any package from this monorepo.
If @types/react
is a dependency of apps/nextjs
, then packages/components
should get autoimport for it.
The only way to get autoimport for react
inside of packages/*
if I add @types/react
to the root package.json
, or to the package.json
of every folder in packages/*
.
This doesn't match runtime behavior.
Add "@types/react": "*"
to root package.json
. This is bad though: the root package shouldn't have dependencies like that.
Adding a tsconfig
to the packages/*
did not help.