Merge pull request #29136 from ajafff/usedbeforedeclaration-objectspread

property is used before its initialization: check more nodes
This commit is contained in:
Ryan Cavanaugh
2019-02-01 13:46:37 -08:00
committed by GitHub
11 changed files with 422 additions and 22 deletions

View File

@@ -19355,7 +19355,19 @@ namespace ts {
case SyntaxKind.PropertyDeclaration:
return true;
case SyntaxKind.PropertyAssignment:
// We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`.
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.SpreadAssignment:
case SyntaxKind.ComputedPropertyName:
case SyntaxKind.TemplateSpan:
case SyntaxKind.JsxExpression:
case SyntaxKind.JsxAttribute:
case SyntaxKind.JsxAttributes:
case SyntaxKind.JsxSpreadAttribute:
case SyntaxKind.JsxOpeningElement:
case SyntaxKind.ExpressionWithTypeArguments:
case SyntaxKind.HeritageClause:
return false;
default:
return isExpressionNode(node) ? false : "quit";