Closed
Description
Discovered while investigating #40584, but is not directly related, and a fix for this is irrelevant to that issue on the whole. Fourslash server test:
/// <reference path="../fourslash.ts" />
// @Filename: /tsconfig.json
//// { "compilerOptions": { "module": "commonjs" } }
// @Filename: /package.json
//// { "dependencies": { "mobx": "*" } }
// @Filename: /node_modules/.pnpm/mobx@6.0.4/node_modules/mobx/package.json
//// { "types": "dist/mobx.d.ts" }
// @Filename: /node_modules/.pnpm/mobx@6.0.4/node_modules/mobx/dist/mobx.d.ts
//// export declare function autorun(): void;
// @Filename: /index.ts
//// autorun/**/
// @link: /node_modules/.pnpm/mobx@6.0.4/node_modules/mobx -> /node_modules/mobx
goTo.marker("");
verify.importFixAtPosition([`import { autorun } from "mobx";\r\n\r\nautorun`]);
The problem is that the pnpm symlink doesn’t make it into the symlink cache, which is coincidentally fixed if there are project references due to:
TypeScript/src/compiler/program.ts
Lines 3762 to 3763 in 8bbef81
The proper fix would probably be to save an originalPath
on ResolvedTypeReferenceDirective
during module resolution, and then do something with it in AutoImportProviderHost.getRootFileNames()
.
Activity