fix(37150): ignore private fields in string index type checking (#37183)

This commit is contained in:
Alexander T
2020-04-10 19:53:53 +03:00
committed by GitHub
parent aa6be6ee6f
commit 795a5c83fe
5 changed files with 58 additions and 0 deletions

View File

@@ -32950,6 +32950,10 @@ namespace ts {
const propDeclaration = prop.valueDeclaration;
const name = propDeclaration && getNameOfDeclaration(propDeclaration);
if (name && isPrivateIdentifier(name)) {
return;
}
// index is numeric and property name is not valid numeric literal
if (indexKind === IndexKind.Number && !(name ? isNumericName(name) : isNumericLiteralName(prop.escapedName))) {
return;