Skip to content

[Typescript] Find All References does not find object properties in multi-module workspace #42976

@WestonThayer

Description

@WestonThayer

TS Template added by @mjbvz

TypeScript Version: 4.2.2.

Search Terms

  • references
  • tsconfig

  • VS Code Version: 1.53.2
  • OS Version: Darwin x64 18.7.0

In a multi-module/project workspace that's using Typescript Project References, if a shared TS project exports an object like:

export const foo = {
  bar: () => {}
};

And two TS projects are consuming it, if you open the workspace in VSCode, the Find All References command invoked on .bar() will only show 2/3 references. Interestingly, if you invoke the command on foo, 3/3 references will be found. And if you were to have all 3 files open, the issue does not reproduce (which makes this issue suspiciously similar to microsoft/vscode#80087).

In the workspace, all 3 projects have "composite": true set and there's a root tsconfig.json referencing all 3, per official docs (without the root tsconfig.json, Find All References won't work for foo either).

Steps to Reproduce:

  1. Clone https://github.com/WestonThayer/bug-vscode-find-refs (minimal repro)
  2. Open in VSCode
  3. Open /api/src/server.ts
  4. Right click .bar() and try the Find All References command

ACTUAL: only api/src/server.ts and shared/src/index.ts are found as references
EXPECTED: all references are found, just like they would be if you right clicked foo

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

Notes

Only applies to when the key of a shared, exported object is a function. For example if the shared code had export const foo = () => {};, Find All References would work fine.

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions