Print TypeParameter even when unary function type (#2406)

master
Dan Wang 2017-07-06 02:13:30 -07:00 committed by Lucas Azzola
parent 7c4a8d07a0
commit 86c88ff278
3 changed files with 21 additions and 0 deletions

View File

@ -3039,6 +3039,7 @@ function printFunctionParams(path, print, options, expandArg, printTypeParams) {
fun[paramsField].length === 1 &&
fun[paramsField][0].name === null &&
fun[paramsField][0].typeAnnotation &&
fun.typeParameters === null &&
flowTypeAnnotations.indexOf(fun[paramsField][0].typeAnnotation.type) !==
-1 &&
!(

View File

@ -156,6 +156,24 @@ type State = {
`;
exports[`type.js 1`] = `
type F = <T>(T) => T;
type G = (<A, B>(A) => B);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type F = <T>(T) => T;
type G = <A, B>(A) => B;
`;
exports[`type.js 2`] = `
type F = <T>(T) => T;
type G = (<A, B>(A) => B);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type F = <T>(T) => T;
type G = <A, B>(A) => B;
`;
exports[`union.js 1`] = `
type Foo = Promise<
{ ok: true, bar: string, baz: SomeOtherLongType } |

View File

@ -0,0 +1,2 @@
type F = <T>(T) => T;
type G = (<A, B>(A) => B);