Skip to content

TypeScript: avoid trailing commas on index signatures with only one parameter#7836

Merged
thorn0 merged 3 commits intoprettier:masterfrom
bakkot:ts-index-sig
Mar 23, 2020
Merged

TypeScript: avoid trailing commas on index signatures with only one parameter#7836
thorn0 merged 3 commits intoprettier:masterfrom
bakkot:ts-index-sig

Conversation

@bakkot
Copy link
Copy Markdown
Collaborator

@bakkot bakkot commented Mar 22, 2020

Fixes #7834. Specifically, it now outputs the trailing comma only when there's multiple parameters. In the usual (non-error) case, it treats it like a computed property name and therefore omits the trailing comma.

See #7224 and #7228 for some context.

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

Try the playground for this PR

@thorn0 thorn0 merged commit 209b1f7 into prettier:master Mar 23, 2020
@bakkot bakkot deleted the ts-index-sig branch March 23, 2020 00:30
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2021
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.

Trailing comma added incorrectly in TypeScript type definition

2 participants