fix TSFunctionType failing on TypeParameters (#1394)

master
Danny Arnold 2017-04-23 19:17:03 +02:00 committed by Christopher Chedeau
parent 44e55f7fa7
commit 5f5566e4ef
3 changed files with 16 additions and 2 deletions

View File

@ -1631,8 +1631,14 @@ function genericPrintNoParens(path, options, print, args) {
if (needsParens) {
parts.push("(");
}
parts.push(path.call(print, "typeParameters"));
if (n.typeParameters && n.typeParameters.length) {
parts.push(
"<",
join(", ", path.map(print, "typeParameters")),
">"
)
}
parts.push(printFunctionParams(path, print, options));

View File

@ -565,6 +565,13 @@ function fn5() {}
`;
exports[`functionTypeTypeParameters.ts 1`] = `
type FuncWithTypeParameter = <T, P>() => {};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type FuncWithTypeParameter = <T, P>() => {};
`;
exports[`parameterInitializersForwardReferencing.ts 1`] = `
function left(a, b = a, c = b) {
a;

View File

@ -0,0 +1 @@
type FuncWithTypeParameter = <T, P>() => {};