Add JS declaration to index constraint check error reporting

Now Javascript-style declarations like `this.foo = "bar"` are handled
correctly.
This commit is contained in:
Nathan Shively-Sanders 2017-05-04 10:11:25 -07:00
parent e1c97e104f
commit 49fd1ad80b

View File

@ -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) {