No this-property assignments in TS (#40009)

* No this-property assignments in TS

Even when `this` is aliased, which I mistakenly allowed in #39908.

* remove errant file
This commit is contained in:
Nathan Shively-Sanders
2020-08-11 15:46:49 -07:00
committed by GitHub
parent 57e2fe0462
commit d371ae770d
5 changed files with 73 additions and 1 deletions

View File

@@ -2487,7 +2487,7 @@ namespace ts {
break;
case AssignmentDeclarationKind.Property:
const expression = ((node as BinaryExpression).left as AccessExpression).expression;
if (isIdentifier(expression)) {
if (isInJSFile(node) && isIdentifier(expression)) {
const symbol = lookupSymbolForName(blockScopeContainer, expression.escapedText);
if (isThisInitializedDeclaration(symbol?.valueDeclaration)) {
bindThisPropertyAssignment(node as BindablePropertyAssignmentExpression);