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
Missing trailing comma in TSX arrow single type param #12076
Comments
In the playground link it's not preserved 🤔 |
Oh I see, even if the playground parses TSX it doesn't not print as if the output file was |
it seems that this issue also can be reproduce. #12479 (comment) writing let arr = <T,>(s:T) => {s} ; in Example.tsx and the comma will preserve. works fine.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Prettier 2.5.1
Playground link
Input:
Output:
Expected behavior:
It should print the trailing comma.
When using TSX, arrow functions with a single type argument must have a trailing comma to disambiguate it from JSX. Babel currently has a bug and parses
<T>() => <div></div>
, but TS doesn't. We are fixing the Babel bug at babel/babel#14135.The text was updated successfully, but these errors were encountered: