Skip to content

Commit 1b62088

Browse files
author
Andy
authored
Assert getExportEqualsLocalSymbol returns a defined result (#21831)
1 parent 868a9ee commit 1b62088

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/services/importTracker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,17 @@ namespace ts.FindAllReferences {
577577

578578
function getExportEqualsLocalSymbol(importedSymbol: Symbol, checker: TypeChecker): Symbol {
579579
if (importedSymbol.flags & SymbolFlags.Alias) {
580-
return checker.getImmediateAliasedSymbol(importedSymbol);
580+
return Debug.assertDefined(checker.getImmediateAliasedSymbol(importedSymbol));
581581
}
582582

583583
const decl = importedSymbol.valueDeclaration;
584584
if (isExportAssignment(decl)) { // `export = class {}`
585-
return decl.expression.symbol;
585+
return Debug.assertDefined(decl.expression.symbol);
586586
}
587587
else if (isBinaryExpression(decl)) { // `module.exports = class {}`
588-
return decl.right.symbol;
588+
return Debug.assertDefined(decl.right.symbol);
589589
}
590-
Debug.fail();
590+
return Debug.fail();
591591
}
592592

593593
// If a reference is a class expression, the exported node would be its parent.

0 commit comments

Comments
 (0)