diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index b8b77193ed0..7c98dba8494 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -4340,7 +4340,7 @@ namespace ts { } } - function getLeftmostExpression(node: Expression, stopAtCallExpressions: boolean) { + function getLeftmostExpression(node: Expression, stopAtCallExpressions: boolean | undefined) { while (true) { switch (node.kind) { case SyntaxKind.PostfixUnaryExpression: @@ -4354,19 +4354,17 @@ namespace ts { case SyntaxKind.ConditionalExpression: node = (node).condition; continue; - case SyntaxKind.CallExpression: if (stopAtCallExpressions) { return node; } // falls through + case SyntaxKind.AsExpression: case SyntaxKind.ElementAccessExpression: case SyntaxKind.PropertyAccessExpression: - node = (node).expression; - continue; - + case SyntaxKind.NonNullExpression: case SyntaxKind.PartiallyEmittedExpression: - node = (node).expression; + node = (node).expression; continue; }