Skip to content

Conversation

@sosukesuzuki
Copy link
Contributor

@sosukesuzuki sosukesuzuki commented Nov 30, 2021

Description

Fixes #11878

Checklist

  • I’ve added tests to confirm my change works.
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

node[typesField].length > 0 &&
getLast(node[typesField]).type === "TSRestType";
const types = node[typesField];
const isNotEmptyTuple = isNonEmptyArray(types);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use isNonEmptyTuple or just isNonEmpty to keep consistent with the function name?

@sosukesuzuki sosukesuzuki merged commit e17404e into prettier:main Nov 30, 2021
@sosukesuzuki sosukesuzuki deleted the fix-11878 branch November 30, 2021 14:48
sosukesuzuki added a commit that referenced this pull request Dec 4, 2021
* Don't print trailing comma when tuple is empty

* Add tests

* Don't print softline

* Add tests

* Update tests

* Add changelog

* Update changelog_unreleased/typescript/11884.md

Co-authored-by: fisker Cheung <[email protected]>

* Fix names

Co-authored-by: fisker Cheung <[email protected]>
@@ -0,0 +1,32 @@
#### Improve formatting for empty tuple types (#11884 by @sosukesuzuki)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When formatting TypeScript generics, a comma was incorrectly inserted in the empty array.

3 participants