Merge pull request #15586 from Microsoft/fix-index-constraint-check-for-js-class-exprs

Add Javascript declarations to index constraint check error reporting
This commit is contained in:
Nathan Shively-Sanders
2017-05-04 12:55:55 -07:00
committed by GitHub
5 changed files with 85 additions and 1 deletions

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