Keep a trailing comma in tsx type parameter#6115
Merged
duailibe merged 4 commits intoprettier:masterfrom May 13, 2019
Merged
Conversation
duailibe
approved these changes
May 13, 2019
| parts.push(" = ", path.call(print, "default")); | ||
| } | ||
|
|
||
| if ( |
Collaborator
There was a problem hiding this comment.
Can you add a comment here just so our future selves can better understand why this is here?
|
How can we test this in the playground? I wanted to report the same bug, cause it wasn't working in the playground (or in the VSCode plugin), and then I found this PR, which seems to be fixing this. |
This was referenced Jun 6, 2019
Closed
4 tasks
Member
|
Hmm, I thought this was part of 1.18 but I can't see the comma on the playground either. Prettier 1.18.0 --parser typescriptInput: type G<T> = any;
const myFunc = <T,>(arg1: G<T>) => false;Output: type G<T> = any;
const myFunc = <T>(arg1: G<T>) => false;@duailibe Do you know? EDIT: Now I get it. The code looks at the file name and checks if it ends with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, a trailing comma after single type parameter in arrow function was cleaned up. The formatted result is valid as ts, but is invalid as tsx. This pr is fix to keep a trailing comma for formatting to valid tsx.
Fixes #6114
docs/directory)CHANGELOG.unreleased.mdfile following the template.✨Try the playground for this PR✨