Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index types not discoverable across files (via find-all-references) #40305

Open
dwelle opened this issue Aug 28, 2020 · 3 comments
Open

index types not discoverable across files (via find-all-references) #40305

dwelle opened this issue Aug 28, 2020 · 3 comments
Labels
Bug A bug in TypeScript Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences.
Milestone

Comments

@dwelle
Copy link

dwelle commented Aug 28, 2020

  • VSCode Version: 1.48.2 (and 1.49.0-insider)
  • OS Version: win 7

Steps to Reproduce:

Create two files:

// file a.ts
// ----------------------------------------------------------------
export type Config = {
    user: number;
}

const someUser: Config["user"] = 42; // (1)

// file b.ts
// ----------------------------------------------------------------
import { Config } from "./a";

const someUser = Config["user"] = 42; // (2)
// const user: Config["user"] = 42; // (3) if you uncomment this, it'll find all references for this file

Then try find all references for the Config["user"]. It finds references in the same file (1), but not in different files (2), UNLESS the file also contains that index type annotating a variable with the same name as the index (3), in which case it finds all references for that file including (2).

Try on CSB: https://codesandbox.io/s/priceless-easley-2w6pi?file=/src/b.ts

This relates to index types only, not base types.

Affects find/peek references/definitions etc.

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

@dwelle
Copy link
Author

dwelle commented Aug 28, 2020

Mhm, it seems it related only to a specific CRA codebase. Will investigate more. nvm, the problem is just a bit more complicated. Updated the OP.

@mjbvz mjbvz transferred this issue from microsoft/vscode Aug 28, 2020
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Sep 11, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Sep 11, 2020
@RyanCavanaugh RyanCavanaugh added the Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences. label Sep 11, 2020
@RyanCavanaugh
Copy link
Member

Then try find all references for the Config["user"]

Which one of the three did you invoke this on?

@dwelle
Copy link
Author

dwelle commented Sep 11, 2020

on (2) (and also the definition itself --- the user: number prop), because it works with (1) as noted. Uncommenting (3) makes everything work, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences.
Projects
None yet
Development

No branches or pull requests

3 participants