Add Javascript declarations to index constraint check error reporting#15586
Conversation
Now Javascript-style declarations like `this.foo = "bar"` are handled correctly.
| let errorNode: Node; | ||
| if (propDeclaration && (propDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol)) { | ||
| if (propDeclaration && | ||
| (getSpecialPropertyAssignmentKind(propDeclaration as BinaryExpression) === SpecialPropertyAssignmentKind.ThisProperty || |
There was a problem hiding this comment.
consider moving this to the end of the check
There was a problem hiding this comment.
It actually needs to come first because JS-style assignments should not hit the computed property check. It won't be very expensive because most declarations are not in javascript files and even there, most declarations are not JS-style assignment declarations.
|
@sandersn, Please port this to release-2.3 |
|
I'll look into normalising use of |
|
It's merged into 2.3 now. |
| if (propDeclaration && (propDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol)) { | ||
| if (propDeclaration && | ||
| (getSpecialPropertyAssignmentKind(propDeclaration as BinaryExpression) === SpecialPropertyAssignmentKind.ThisProperty || | ||
| propDeclaration.name.kind === SyntaxKind.ComputedPropertyName || |
There was a problem hiding this comment.
This may crash if propDeclaration.name is undefined.
see #15681
Now Javascript-style declarations like
this.foo = "bar"are handledcorrectly and errors will be reported on the declaration correctly. Previously the code would check the computed property name case and crash because Javascript-style declarations have no
nameproperty.Fixes #15525