Skip to content

Commit 403f585

Browse files
authored
enclosingDeclaration can be undefined within getAccessibleSymbolChain (#18400)
1 parent 2fbc225 commit 403f585

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ namespace ts {
20632063
return rightMeaning === SymbolFlags.Value ? SymbolFlags.Value : SymbolFlags.Namespace;
20642064
}
20652065

2066-
function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] | undefined {
2066+
function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] | undefined {
20672067
if (!(symbol && !isPropertyOrMethodDeclarationSymbol(symbol))) {
20682068
return undefined;
20692069
}
@@ -2112,7 +2112,7 @@ namespace ts {
21122112
if (symbolFromSymbolTable.flags & SymbolFlags.Alias
21132113
&& symbolFromSymbolTable.escapedName !== "export="
21142114
&& !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)
2115-
&& !(isUMDExportSymbol(symbolFromSymbolTable) && isExternalModule(getSourceFileOfNode(enclosingDeclaration)))
2115+
&& !(isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && isExternalModule(getSourceFileOfNode(enclosingDeclaration)))
21162116
// If `!useOnlyExternalAliasing`, we can use any type of alias to get the name
21172117
&& (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration))) {
21182118

@@ -2132,7 +2132,7 @@ namespace ts {
21322132
}
21332133
}
21342134

2135-
function needsQualification(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) {
2135+
function needsQualification(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags) {
21362136
let qualify = false;
21372137
forEachSymbolTableInScope(enclosingDeclaration, symbolTable => {
21382138
// If symbol of this name is not available in the symbol table we are ok

0 commit comments

Comments
 (0)