TypeScript: fix trailing comma in enum (#1938)

* fix(typescript): fix trailing comma in enum, fixes #1932

* fix(typescript): use --trailing-comma es5 for enums
master
Lucas Azzola 2017-06-03 22:20:36 +10:00 committed by Christopher Chedeau
parent c57f2ab507
commit 649cec7fdd
3 changed files with 17 additions and 1 deletions

View File

@ -2459,7 +2459,8 @@ function genericPrintNoParens(path, options, print, args) {
indent(
concat([
hardline,
printArrayItems(path, options, "members", print)
printArrayItems(path, options, "members", print),
shouldPrintComma(options, "es5") ? "," : ""
])
),
comments.printDanglingComments(

View File

@ -5,9 +5,19 @@ export class BaseSingleLevelProfileTargeting<
T extends ValidSingleLevelProfileNode,
> {
}
enum Enum {
x = 1,
y = 2,
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export class BaseSingleLevelProfileTargeting<
T extends ValidSingleLevelProfileNode
> {}
enum Enum {
x = 1,
y = 2,
}
`;

View File

@ -2,3 +2,8 @@ export class BaseSingleLevelProfileTargeting<
T extends ValidSingleLevelProfileNode,
> {
}
enum Enum {
x = 1,
y = 2,
}