TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Wrong import suggestions for JavaScript default exports

Open klaussner opened this issue 1 year ago • 0 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.90.0-insider (a48f464a3e01aad384703ec964018299b14bb7cf)
  • OS Version: macOS Sonoma 14.4.1

If an npm package re-exports type definitions from nested paths, VS Code suggests wrong import paths for default exports. I noticed the issue when I tried to use packages from Atlassian's design system (e.g., @atlaskit/button), but I was able to reproduce it with a minimal example (see below).

Steps to Reproduce:

  1. Clone this issue reproduction repository: https://github.com/klaussner/vs-code-import-issue
  2. Follow the steps in README.md.

The video below shows how VS Code suggests the correct path for the named export, but the wrong path for the default export. The expected result is import defaultExport, { namedExport } from "example";.

https://github.com/microsoft/vscode/assets/1312807/7a85fb0e-9cfb-4d35-a05b-48752b24fa2d

klaussner avatar May 17 '24 18:05 klaussner