Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 1.65 KB

CHANGELOG.unreleased.md

File metadata and controls

79 lines (57 loc) · 1.65 KB

TypeScript: Add trailing comma in tsx, only for arrow function (#6190 by @sosukesuzuki)

Prettier inserts a trailing comma to single type parameter for arrow functions in tsx, since v 1.18. But, this feature inserts a trailing comma to type parameter for besides arrow functions too (e.g, function , interface). This change fix it.

// Input
interface Interface1<T> {
  one: "one";
}
function function1<T>() {
  return "one";
}

// Output (Prettier stable)
interface Interface1<T,> {
  one: "one";
}
function function1<T,>() {
  return "one";
}

// Output (Prettier master)
interface Interface1<T> {
  one: "one";
}
function function1<T>() {
  return "one";
}