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

505 B

Add basic support for "match" syntax (#17681 by @fisker)

// Input
const e = match (a) {
  1 => true,
  'foo' => false,
  2 => {obj: 'literal'},
};

// Prettier stable
SyntaxError: Unexpected token `{`, expected the token `;` (1:21)
> 1 | const e = match (a) {
    |                     ^
  2 |   1 => true,
  3 |   'foo' => false,
  4 |   2 => {obj: 'literal'},

// Prettier main
const e = match (a) {
  1 => true,
  "foo" => false,
  2 => { obj: "literal" },
};