You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Trailing commas for type parameters in TypeScript #3662
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.
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: --parser [email protected]? Would require changing all those options.parser === "typescript" lines to some form of parserIsLanguage(options.parser, "typescript").
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.
Activity
azz commentedon Jan 6, 2018
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?
JoshuaKGoldberg commentedon Jan 6, 2018
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:
--parser [email protected]? Would require changing all thoseoptions.parser === "typescript"lines to some form ofparserIsLanguage(options.parser, "typescript").azz commentedon Jan 6, 2018
I don't think such a small thing warrants the maintenance overhead of such a flag.
j-f1 commentedon Jan 6, 2018
We could only add it when you set
--trailing-comma all, which assumes you’re using recent versions of stuff.duailibe commentedon Jan 6, 2018
Related: #3313 (comment)
sharno commentedon Sep 11, 2019
This issue causes a failure to compile
.tsx(React) files after prettier formatting for this case:The trailing comma is needed especially for
.tsxfiles for the compiler to recognize that this is a type and not ajsxtaglydell commentedon Sep 11, 2019
@sharno Prettier already seems to handle the trailing comma in that case:
sharno commentedon Sep 11, 2019
@lydell I see, it seems to be a problem in https://github.com/prettier/prettier-vscode