Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Mar 23, 2020

Conversation

bakkot
Copy link
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