microsoft / microsoft/TypeScript

Suggestion: ability to find imports for module

Open
#22,374 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Find references is a very useful feature, however sometimes I need to be able to find all imports of a given module:

  • regardless of what they're exporting
  • but the module does not have any exports

This is sometimes necessary when a module has side effects, and you want to see which files imported it.

This might also be useful for dynamic imports. In one project we have several dynamic imports (for code splitting) that never explicitly reference the module exports, so if I use find references on those module exports, I will not be shown the dynamic import. For example, here is a dynamic import:

image

When I activate find references on the exports of that module, I am not shown the import:

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

The issue names no source files or tests. Start by reproducing Find References on a module with side effects and on a dynamic import, then trace the language-service behavior that resolves references. Done means imports are discoverable even when no exports are referenced, including dynamic imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.