diff --git a/src/printer.js b/src/printer.js index 2706f4e2..82a06cc7 100644 --- a/src/printer.js +++ b/src/printer.js @@ -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 && !( diff --git a/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap b/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap index a3a442a1..620200f6 100644 --- a/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap @@ -156,6 +156,24 @@ type State = { `; +exports[`type.js 1`] = ` +type F = (T) => T; +type G = ((A) => B); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +type F = (T) => T; +type G = (A) => B; + +`; + +exports[`type.js 2`] = ` +type F = (T) => T; +type G = ((A) => B); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +type F = (T) => T; +type G = (A) => B; + +`; + exports[`union.js 1`] = ` type Foo = Promise< { ok: true, bar: string, baz: SomeOtherLongType } | diff --git a/tests/flow_generic/type.js b/tests/flow_generic/type.js new file mode 100644 index 00000000..1ae2bcfe --- /dev/null +++ b/tests/flow_generic/type.js @@ -0,0 +1,2 @@ +type F = (T) => T; +type G = ((A) => B);