Files
test-repo/changelog_unreleased/flow/11004.md
T

466 B

Fix parenthesis for optional function as return type (#11004 by @vjeux, @fisker)

// Input
const fun = (a: number): (?(string => string)) => {
  return a > 0 ? s => `${s}: ${a}` : null;
};

// Prettier stable
const fun = (a: number): ?(string) => string => {
  return a > 0 ? (s) => `${s}: ${a}` : null;
};

// Prettier main
const fun = (a: number): (?(string) => string) => {
  return a > 0 ? (s) => `${s}: ${a}` : null;
};