mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user