microsoft / microsoft/TypeScript

Issues trying to auto-import across project boundaries

Open
#29,605 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.2.2, 3.3.0-rc

Search Terms: autoimport, project references, autocomplete

Code
Full minimal repro: https://github.com/MLoughry/typescript-repro

See src/a/lib/index.ts

// If another file in the project already has an import from the other project,
//   then attempting to auto-import `bar` will prompt you to import from 'obj/b/lib'
// If no other import is found within the project, no auto-import suggestions are found
console.log(bar);

Expected behavior:
Auto-import should work across project boundaries when an outDir is specified (with or without paths specified in tsconfig.json)

Actual behavior:

  • If there is already a cross-project import within the project: The auto-import attempts to import from the outDir.
    image
  • If there is no other cross-project import within the project: No import suggestions are found.
    image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked minimal reproduction and src/a/lib/index.ts, then inspect the project-reference and tsconfig.json setup, including outDir and paths. Compare auto-import behavior when a cross-project import already exists with behavior when it does not; done means suggestions work across project boundaries without importing from the outDir.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.