mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Filter out empty access expression
This commit is contained in:
@@ -1338,13 +1338,16 @@ namespace ts.Completions {
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
propertyAccessToConvert = parent as PropertyAccessExpression;
|
||||
node = propertyAccessToConvert.expression;
|
||||
if ((isCallExpression(node) || isFunctionLike(node)) &&
|
||||
node.end === contextToken.pos &&
|
||||
node.getChildCount(sourceFile) &&
|
||||
last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken) {
|
||||
const leftMostAccessExpression = getLeftmostAccessExpression(parent as Expression);
|
||||
if (leftMostAccessExpression.pos === leftMostAccessExpression.end ||
|
||||
((isCallExpression(node) || isFunctionLike(node)) &&
|
||||
node.end === contextToken.pos &&
|
||||
node.getChildCount(sourceFile) &&
|
||||
last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken)) {
|
||||
// This is likely dot from incorrectly parsed expression and user is starting to write spread
|
||||
// eg: Math.min(./**/)
|
||||
// const x = function (./**/) {}
|
||||
// ({./**/})
|
||||
return undefined;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user