Parse generic function types in import type argument lists (#31079)

* Parenthesize in import type node factory

* And now parse unparenthesized generic functions so we can handle parsing the older output
This commit is contained in:
Wesley Wigham
2019-04-23 14:48:31 -07:00
committed by GitHub
parent 8fc6640f55
commit d7f03fb0fa
11 changed files with 206 additions and 2 deletions
+1 -1
View File
@@ -845,7 +845,7 @@ namespace ts {
const node = <ImportTypeNode>createSynthesizedNode(SyntaxKind.ImportType);
node.argument = argument;
node.qualifier = qualifier;
node.typeArguments = asNodeArray(typeArguments);
node.typeArguments = parenthesizeTypeParameters(typeArguments);
node.isTypeOf = isTypeOf;
return node;
}
+3 -1
View File
@@ -2922,7 +2922,9 @@ namespace ts {
if (parseOptional(SyntaxKind.DotToken)) {
node.qualifier = parseEntityName(/*allowReservedWords*/ true, Diagnostics.Type_expected);
}
node.typeArguments = tryParseTypeArguments();
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === SyntaxKind.LessThanToken) {
node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
}
return finishNode(node);
}