-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
📝 Formatter breaks TSX syntax with comment on first line of generic #5091
Comments
It looks like this is a bug in Prettier as well. The generated code is valid TypeScript when JSX is disabled, but becomes invalid when JSX is enabled:
I’m not sure what the best solution for this would be; maybe keeping the new line if JSX syntax is enabled? |
The code works if there is any whitespace between the |
@dyc3 it's been an error in TS since "forever" (at least since 3.3) as far as I can tell. The code also works if the comment uses Maybe this is a limitation of their grammar, similar to how On a somehow related note, it looks like Prettier handles that case by adding a comma before Should I open a bug for this or is it a known/won't fix issue? |
Hmm, yeah that case is quite ambiguous. I'm open to diverging from prettier here to add/keep whitespace between the |
Environment information
Configuration
Playground link
https://biomejs.dev/playground/?code=dAB5AHAAZQAgAEcAZQBuAGUAcgBpAGMAPABUAD4AIAA9ACAAVAAKAAoAZABlAGMAbABhAHIAZQAgAGMAbwBuAHMAdAAgAE4AYQBtAGUAcwBwAGEAYwBlADoAIAB7AAoACQBDAG8AbQBwAG8AbgBlAG4AdAA6ACAARwBlAG4AZQByAGkAYwA8AAoACQAJAC8ALwAgAGEAIABjAG8AbQBtAGUAbgB0AAoACQAJAHsACgAJAAkACQBjAGgAaQBsAGQAcgBlAG4AOgAgAHUAbgBrAG4AbwB3AG4AOwAKAAkACQB9AAoACQA%2BADsACgB9AAoA
Code of Conduct
The text was updated successfully, but these errors were encountered: