Skip to content

Indexed access on typeof import("...") is not a valid referenceΒ #62541

@KazariEX

Description

@KazariEX

πŸ”Ž Search Terms

"indexed access", "typeof import", reference

πŸ•— Version & Regression Information

This is the behavior in every version I tried.

⏯ Playground Link

playground

I cannot reproduce this on the typescript playground because it doesn't seem to have a file system.

https://www.typescriptlang.org/dev/bug-workbench/?#code/PTAEAEDMEsBsFMB2BDAtvAXKaqAOB7AJwBcBnAOgBNyyAoHAk0AKlGVNABIAGUSQ-KlAAicsABGyQsIDctWpXgBjWFPigA5rHyTYoAN61QoJfkSliffPizEAnrnj5I2PEWIAKUcEjXhASgBtYV98YQBdOWNTc0tJQlsHJxcGdy8xeIDgzMjaAF95eAAPRkt9PLlaEAgYBBR0LFCaUlpi0pMzCyt8UABeUABGSuqoOCQ0TFB45taS9w7Yqak+wcqgA

πŸ’» Code

// imports.d.ts
import * as $0 from "./bar";

declare global {
  const foo: typeof import("./foo")["foo"];
  const bar: typeof import("./bar")["bar"];
}

export {};
// foo.ts
export const foo = 1;
// bar.ts
export const bar = 1;

πŸ™ Actual behavior

Triggering Go to References on foo in foo.ts does not result in any references. But triggering on bar in bar.ts, the reference symbol in imports.d.ts is correctly found, as there is an import statement of bar.ts.

πŸ™‚ Expected behavior

Triggering Go to References on foo in foo.ts correctly finds the reference symbol in imports.d.ts. Its behavior should be consistent with dot access.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions