fix(42166): allow assertion signature for private identifiers (#42176)

This commit is contained in:
Oleksandr T
2021-01-11 19:25:51 +02:00
committed by GitHub
parent 8ddea6b7a6
commit 1ecf22884f
5 changed files with 119 additions and 3 deletions

View File

@@ -21852,10 +21852,15 @@ namespace ts {
return getExplicitThisType(node);
case SyntaxKind.SuperKeyword:
return checkSuperExpression(node);
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.PropertyAccessExpression: {
const type = getTypeOfDottedName((<PropertyAccessExpression>node).expression, diagnostic);
const prop = type && getPropertyOfType(type, (<PropertyAccessExpression>node).name.escapedText);
return prop && getExplicitTypeOfSymbol(prop, diagnostic);
if (type) {
const name = (<PropertyAccessExpression>node).name;
const prop = getPropertyOfType(type, isPrivateIdentifier(name) ? getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText) : name.escapedText);
return prop && getExplicitTypeOfSymbol(prop, diagnostic);
}
return undefined;
}
case SyntaxKind.ParenthesizedExpression:
return getTypeOfDottedName((<ParenthesizedExpression>node).expression, diagnostic);
}