From 49fd1ad80b19aa2ef1110d6f5255ba4fe4efd15f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 4 May 2017 10:11:25 -0700 Subject: [PATCH] Add JS declaration to index constraint check error reporting Now Javascript-style declarations like `this.foo = "bar"` are handled correctly. --- src/compiler/checker.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e1ed2f4fa1f..9649a4b3bdc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20233,7 +20233,10 @@ namespace ts { // 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 && + (getSpecialPropertyAssignmentKind(propDeclaration as BinaryExpression) === SpecialPropertyAssignmentKind.ThisProperty || + propDeclaration.name.kind === SyntaxKind.ComputedPropertyName || + prop.parent === containingType.symbol)) { errorNode = propDeclaration; } else if (indexDeclaration) {