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 + JSX (TSX): required trailing commas are stripped from type parameters #6302

Closed
OliverJAsh opened this issue Jul 16, 2019 · 2 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Comments

@OliverJAsh
Copy link

Prettier 1.18.2
Playground link

Input:

const fn = <T,>(t: T) => t;

Output:
This is invalid syntax for a .tsx file. TypeScript needs the comma because without it, the syntax is ambiguous.

const fn = <T>(t: T) => t;

Expected behavior:

const fn = <T,>(t: T) => t;
@sosukesuzuki
Copy link
Member

this issue is duplicated to #6114 . Also, fixed in #6115 and #6190 .
But, it behavior depends on file extension(.tsx), so we cannot see it in Playground (Playground is not supported file extension).

If you run prettier in CLI and file extension is tsx, syntax error does not happen.

@OliverJAsh
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants