Skip to content

VSCode's auto import not suggesting packages since typescript: "4.2.1-rc" #56166

Closed as not planned
@ciriousjoker

Description

@ciriousjoker

🔎 Search Terms

many permutations of the following keywords:

vscode, intellisense, auto, import, typescript, typescript language server, tsconfig, node_modules

Also explicitly scanned the FAQ for "import".

🕗 Version & Regression Information

  • This is an issue with VSCode's intellisense not suggesting the correct imports
  • This changed between versions 4.1.5 (works) and 4.2.1-rc (broken). There's only one version between (4.3.0-dev.20210211) and it's also broken.
  • This changed in commit or PR _______ no idea how to test this
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

https://codesandbox.io/s/demo-fail-imports-kwrxd6?file=/main.ts

💻 Code

The broken behavior can be demonstrated with the codesandbox link. However, the correct behavior can only be demonstrated by cloning this repository:
https://github.com/ciriousjoker/demo_fail_imports

The code is the same, but codesandbox.io doesn't support switching between typescript versions and other solutions like stackblitz don't support auto imports at all. Again, remember to restart the TS server between Typescript version switches.

🙁 Actual behavior

Import isn't suggested.

CleanShot 2023-10-21 at 02 29 06@2x

🙂 Expected behavior

Import should be suggested.

CleanShot 2023-10-21 at 02 29 30@2x

Additional information about the issue

  1. Removing any single of the dependencies "fixes" the issue, but that's not a feasable solution (npm install isn't even necessary, just altering the package.json triggers an "update" in this regard)
  2. Given that this worked with previous Typescript versions, it seems like this is a Typescript bug, not a bug with the dependencies
  3. Dependencies shouldn't break suggestions if npm install worked successfully (in my opinion)

I'm aware that typescript has some magic sauce to determine when to load type definitions, ie the "you have to import it once for Typescript to find it". However, I believe that with this minimal reproducible sample repo this (in my opinion) bug might be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions