fix typeParameters printing TSFunctionType w/o breaking flow (#1397)
parent
6f0cc31fdb
commit
689e520abe
|
@ -1632,12 +1632,16 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
parts.push("(");
|
||||
}
|
||||
|
||||
if (n.typeParameters && n.typeParameters.length) {
|
||||
// With TypeScript `typeParameters` is an array of `TSTypeParameter` and
|
||||
// with flow they are one `TypeParameterDeclaration` node.
|
||||
if (n.type === 'TSFunctionType' && n.typeParameters) {
|
||||
parts.push(
|
||||
"<",
|
||||
join(", ", path.map(print, "typeParameters")),
|
||||
">"
|
||||
)
|
||||
} else {
|
||||
parts.push(path.call(print, "typeParameters"));
|
||||
}
|
||||
|
||||
parts.push(printFunctionParams(path, print, options));
|
||||
|
|
Loading…
Reference in New Issue