From ad71da0a7f36fafa8e940c388fd503c60ae6afee Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 21 Jan 2017 13:06:54 -0800 Subject: [PATCH] Fix error reporting bug --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a5058bdf7f2..3242a30d381 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18240,14 +18240,14 @@ namespace ts { const propDeclaration = prop.valueDeclaration; // index is numeric and property name is not valid numeric literal - if (indexKind === IndexKind.Number && propDeclaration && !isNumericName(propDeclaration.name)) { + if (indexKind === IndexKind.Number && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class let errorNode: Node; - if (propDeclaration && propDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol) { + if (propDeclaration && (propDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol)) { errorNode = propDeclaration; } else if (indexDeclaration) {