Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing and generating flow type moves parentheses #10517

Closed
andy-hanson opened this issue Oct 2, 2019 · 1 comment · Fixed by #10519

Comments

@andy-hanson
Copy link

commented Oct 2, 2019

Bug Report

Input Code

packages/babel-generator/test/fixtures/types/ArrowFunctionExpression2/input.js:

const pair = <T>(a: T): (T => T[]) => b => [a, b]

packages/babel-generator/test/fixtures/types/ArrowFunctionExpression2/options.json:

{ "plugins": ["flow"] }

Expected behavior/code
The output should be the same as the input, with the parentheses around (T => T[]).

Current Behavior
Output code is:

const pair = <T>(a: T): (T) => T[] => b => [a, b];

The parentheses have moved from (T => T[]) to (T) => T[].
Flow now gives a parse error on the output, where it worked for the original.

Environment

  • Babel version(s): master
  • Node/npm version: Node 10/npm 6
  • OS: Linux Mint 18.1
  • Monorepo: yes
  • How you are using Babel: env TEST_ONLY=babel-generator make test
@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Oct 2, 2019

Hey @andy-hanson! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.