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

Necessary trailing comma in generic type in .tsx file gets removed #955

Closed
sharno opened this issue Sep 11, 2019 · 3 comments
Closed

Necessary trailing comma in generic type in .tsx file gets removed #955

sharno opened this issue Sep 11, 2019 · 3 comments
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@sharno
Copy link

sharno commented Sep 11, 2019

Summary

Trailing comma in this example .tsx file gets removed. The comma is necessary for the typescript compiler to recognize that it's a type not a JSX tag

const f = <T, >() => 1

It seems to be not an issue in prettier itself

VS Code Version:
1.38.0

Prettier & Prettier Plugin Version:
2.2.2

OS and version:
Windows 10

@shiatsumat
Copy link

Since Prettier correctly handles necessary trailing commas if the file extension is .tsx, it seems that the information that VSCode gives to Prettier is insufficient.
See also prettier/prettier#6302.

shiatsumat added a commit to shiatsumat/prettier-vscode that referenced this issue Sep 25, 2019
Add `filepath` to `prettierOptions` in `PrettierEditProvider.ts`.
This resolves the issue of prettier#955, since prettier judges whether a file is `*.tsx` based on `options.filepath` (see https://github.com/prettier/prettier/blob/bb037eb218cbcf914575fe95d9f43e87ffab69a9/src/language-js/printer-estree.js).
@ntotten
Copy link
Member

ntotten commented Oct 11, 2019

Resolved in 035b4c4

@ntotten ntotten closed this as completed Oct 11, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Apr 12, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

3 participants