diff --git a/src/printer.js b/src/printer.js index fdfa8eef0..56c6ec1bb 100644 --- a/src/printer.js +++ b/src/printer.js @@ -3229,6 +3229,8 @@ function printFunctionParams(path, print, options, expandArg) { fun[paramsField][0].typeAnnotation && flowTypeAnnotations.indexOf(fun[paramsField][0].typeAnnotation.type) !== -1 && + !(fun[paramsField][0].typeAnnotation.type === "GenericTypeAnnotation" && + fun[paramsField][0].typeAnnotation.typeParameters) && !fun.rest; if (isFlowShorthandWithOneArg) { diff --git a/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap b/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap index bd82002ab..36cc71ba6 100644 --- a/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap @@ -78,6 +78,8 @@ class X { interface F { ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection } + +type ExtractType = (B) => D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Banana = { eat: string => boolean @@ -121,6 +123,8 @@ interface F { ideConnectionFactoryLongLongLong: child_process$ChildProcess => FlowIDEConnection } +type ExtractType = (B) => D; + `; exports[`test.js 2`] = ` @@ -167,6 +171,8 @@ class X { interface F { ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection } + +type ExtractType = (B) => D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Banana = { eat: string => boolean, @@ -210,4 +216,6 @@ interface F { ideConnectionFactoryLongLongLong: child_process$ChildProcess => FlowIDEConnection, } +type ExtractType = (B) => D; + `; diff --git a/tests/flow_function_parentheses/test.js b/tests/flow_function_parentheses/test.js index 9ce0546fb..7f3bfab76 100644 --- a/tests/flow_function_parentheses/test.js +++ b/tests/flow_function_parentheses/test.js @@ -41,3 +41,5 @@ class X { interface F { ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection } + +type ExtractType = (B) => D