Disallow line break between entity name and type arguments in typeof expression (#48755)

This commit is contained in:
Jake Bailey
2022-04-18 16:18:31 -07:00
committed by GitHub
parent 65f6cb23d3
commit d3943fc86f
5 changed files with 37 additions and 1 deletions

View File

@@ -3189,7 +3189,8 @@ namespace ts {
const pos = getNodePos();
parseExpected(SyntaxKind.TypeOfKeyword);
const entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
const typeArguments = tryParseTypeArguments();
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
const typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
}