Skip to content

Wrong import suggestions for JavaScript default exports #58590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
klaussner opened this issue May 17, 2024 · 2 comments · Fixed by #58837
Closed

Wrong import suggestions for JavaScript default exports #58590

klaussner opened this issue May 17, 2024 · 2 comments · Fixed by #58837
Assignees
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@klaussner
Copy link

klaussner commented May 17, 2024

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

  • VS Code Version: 1.90.0-insider (a48f464)
  • 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";.

VS.Code.import.issue.mp4
@mjbvz mjbvz transferred this issue from microsoft/vscode May 20, 2024
@klaussner
Copy link
Author

Thank you for moving this to the right repository, @mjbvz. I didn't realize that the suggestions are coming from TypeScript.

I tracked down two commits related to the issue using git bisect:

@klaussner
Copy link
Author

Could someone from the TypeScript team confirm the issue, perhaps @andrewbranch (the author of the two pull requests I linked above)? Please let me know if there's anything I can do to help get this fixed.

@andrewbranch andrewbranch assigned andrewbranch and unassigned mjbvz Jun 10, 2024
@andrewbranch andrewbranch added the Needs Investigation This issue needs a team member to investigate its status. label Jun 10, 2024
@andrewbranch andrewbranch added this to the TypeScript 5.6.0 milestone Jun 10, 2024
@typescript-bot typescript-bot added Fix Available A PR has been opened for this issue labels Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants