Description
π Search Terms
"import devDependencies"
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about devDependencies
β― Playground Link
https://github.com/DerGernTod/typescript-auto-import/tree/main
π» Code
// file: packages/consumer-dependency/src/dep-consumer.ts
let m: MyInterface;
// file: packages/consumer-dependency/package.json
{
...
"dependencies": {
"lib": "workspace:*"
}
}
// file: packages/consumer-dev-dependency/src/dev-consumer.ts
let m: MyInterface;
// file: packages/consumer-dependency/package.json
{
...
"devDependencies": {
"lib": "workspace:*"
}
}
// file: packages/lib/src/the-lib.ts
export interface MyInterface {
foo: string;
}
{
...
"exports": {
"./the-lib": "./dist/the-lib.js"
}
}
π Actual behavior
Fetching tsc suggestions on let m: MyInterface;
in dep-consumer.ts
yields the correct Add import from "lib/the-lib"
.
Fetching tsc suggestions on let m: MyInterface;
in dev-consumer.ts
yields no result.
π Expected behavior
Fetching tsc suggestions on let m: MyInterface;
in dev-consumer.ts
also yields the correct Add import from "lib/the-lib"
.
Additional information about the issue
Please see the attached reproducer repo. I couldn't figure out a way to build this in TS playground. If there is a way, I'd be glad if someone could enlighten me :)
This might be related to pnpm workspaces imports. While building the reproducer, I started out with npm workspaces and file: dependencies. The behavior was a little different: for the dev dependencies, tsc tried to import from "../../lib/src/the-lib" (which obviously also doesn't work). The import from dependencies also worked fine though. After restarting the language server, once it also worked with "lib/the-lib" but I was never able to get a correct suggestion afterwards.