Fix for crash when using ca call expression on private identifier coming from an any typed variable. (GH #42860) (#42861)

This commit is contained in:
Titian Cernicova-Dragomir
2021-02-18 13:54:10 -08:00
committed by GitHub
parent d2737ecd17
commit a2ed469022
6 changed files with 145 additions and 2 deletions
+10 -1
View File
@@ -21978,7 +21978,16 @@ namespace ts {
const type = getTypeOfDottedName((<PropertyAccessExpression>node).expression, diagnostic);
if (type) {
const name = (<PropertyAccessExpression>node).name;
const prop = getPropertyOfType(type, isPrivateIdentifier(name) ? getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText) : name.escapedText);
let prop: Symbol | undefined;
if (isPrivateIdentifier(name)) {
if (!type.symbol) {
return undefined;
}
prop = getPropertyOfType(type, getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText));
}
else {
prop = getPropertyOfType(type, name.escapedText);
}
return prop && getExplicitTypeOfSymbol(prop, diagnostic);
}
return undefined;