@@ -555,6 +555,7 @@ namespace ts.FindAllReferences {
555
555
// Similarly, skip past the symbol for 'export ='
556
556
if ( importedSymbol . escapedName === "export=" ) {
557
557
importedSymbol = getExportEqualsLocalSymbol ( importedSymbol , checker ) ;
558
+ if ( importedSymbol === undefined ) return undefined ;
558
559
}
559
560
560
561
// If the import has a different name than the export, do not continue searching.
@@ -577,22 +578,22 @@ namespace ts.FindAllReferences {
577
578
}
578
579
}
579
580
580
- function getExportEqualsLocalSymbol ( importedSymbol : Symbol , checker : TypeChecker ) : Symbol {
581
+ function getExportEqualsLocalSymbol ( importedSymbol : Symbol , checker : TypeChecker ) : Symbol | undefined {
581
582
if ( importedSymbol . flags & SymbolFlags . Alias ) {
582
- return Debug . checkDefined ( checker . getImmediateAliasedSymbol ( importedSymbol ) ) ;
583
+ return checker . getImmediateAliasedSymbol ( importedSymbol ) ;
583
584
}
584
585
585
586
const decl = Debug . checkDefined ( importedSymbol . valueDeclaration ) ;
586
587
if ( isExportAssignment ( decl ) ) { // `export = class {}`
587
- return Debug . checkDefined ( decl . expression . symbol ) ;
588
+ return decl . expression . symbol ;
588
589
}
589
590
else if ( isBinaryExpression ( decl ) ) { // `module.exports = class {}`
590
- return Debug . checkDefined ( decl . right . symbol ) ;
591
+ return decl . right . symbol ;
591
592
}
592
593
else if ( isSourceFile ( decl ) ) { // json module
593
- return Debug . checkDefined ( decl . symbol ) ;
594
+ return decl . symbol ;
594
595
}
595
- return Debug . fail ( ) ;
596
+ return undefined ;
596
597
}
597
598
598
599
// If a reference is a class expression, the exported node would be its parent.
0 commit comments