-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Trailing commas for type parameters in TypeScript #3662
Comments
Prettier rolls in it's own copy of the TypeScript parser, and we don't detect the version of TypeScript at all. Does trailing commas in the case even add any value? It's not like you ever have a large list of type parameters where diffing is a problem? |
It's not a problem, just a convenience. I would prefer having them for the same reason I'd like to have them in arrays and object literals (though admittedly not with the same level of convenience). Perhaps this can be revisited if & when the minimum TypeScript version is 2.7... Edit: Ooh or: |
I don't think such a small thing warrants the maintenance overhead of such a flag. |
We could only add it when you set |
Related: #3313 (comment) |
This issue causes a failure to compile const f = <T, >() => 1 The trailing comma is needed especially for |
@sharno Prettier already seems to handle the trailing comma in that case:
|
@lydell I see, it seems to be a problem in https://github.com/prettier/prettier-vscode |
Prettier 1.9.2
I would paste a playground link but no TypeScript support ;)I'm silly: Playground linkInput:
Expected behavior:
There should be a trailing comma after
= SourceNode
.Actual behavior:
As of fa708d1, it will not.
TypeScript 2.7 will be the first version to allow it (microsoft/TypeScript#16152). Should prettier add them back if TS is > 2.7?
The text was updated successfully, but these errors were encountered: