TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

getSymbolAtLocation returns wrong symbol for import alias in RHS of "import ="

Open jeffreymorlan opened this issue 11 years ago • 1 comments

module SomeModule { export class SomeClass {} }

import M = SomeModule;  // or import M = require(...)
import C = M.SomeClass;

On the M identifier in M.SomeClass, getSymbolAtLocation returns the SomeModule module symbol, rather than the alias M to it.

This affects renaming, find references, and occurrence highlighting:

  • If you select the M in import M = ..., the second M will not be found
  • If you select the M in import C = M.SomeClass, the first M will not be found, but the two SomeModule references will be found instead.

jeffreymorlan avatar Nov 03 '15 00:11 jeffreymorlan

Yeah, rename on aliases seems to be extremely broken.

brokenaliases

DanielRosenwasser avatar Nov 03 '15 07:11 DanielRosenwasser