Skip to content

No import suggestions for transitive dependencies in [v3.7.3] #35560

Closed
@gdostie

Description

@gdostie

TypeScript Version: 3.7.3

Search Terms: auto-import suggestions transitive dependencies

Description of the issue

Auto-import suggestions for transitive dependencies exported types don't show up anymore.

  • In version 3.6.4 it works fine.
  • If you delete package.json the suggestions start showing-up
  • Tried in vscode and webstorm and the same behavior happens in both

Code

// package Z
const Crab = "🦀";

export function logCrab() {
  console.log(Crab);
}

export function logCrab2() {
  console.log(Crab);
  console.log(Crab);
}

// package Y (depends on Z)
import { logCrab, logCrab2 } from "demo-imports-issue-dep-dep";

const Pineapple = "🍍";

export function logPineapple() {
  logCrab();
  console.log(Pineapple);
}

export function logPineapple2() {
  logCrab2();
  console.log(Pineapple);
  console.log(Pineapple);
}

// package X (depends on Y)
import { logPineapple } from "demo-imports-issue-dep";
import { logCrab } from "demo-imports-issue-dep-dep";

logPineapple();
logCrab();
// log <-- type this and hit the shortcut to have suggestions

Expected behavior:
v3.6.4 (notice logCrab2 is in the suggestions)
import-issues-3 6 4

Actual behavior:
v3.7.3 with package.json (notice logCrab2 isn't in the suggestions):
import-issues-3 7 3

v3.7.3 without package.json (notice logCrab2 is in the suggestions)
import-issues-3 7 3-no-packagejson

Playground Link:

Base project example: https://github.com/gdostie/demo-imports-issue
Project's direct dependency: https://github.com/gdostie/demo-imports-issue-dep
Project's transitive dependency (which exports the logCrab2 function): https://github.com/gdostie/demo-imports-issue-dep-dep

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions