Fix forced trailing comma (#382)
We shouldn't output trailing commas when there is a forced one when we break. Fixes #380master
parent
1f92218a06
commit
3d95e8317b
|
@ -637,7 +637,7 @@ function genericPrintNoParens(path, options, print) {
|
|||
])
|
||||
),
|
||||
needsForcedTrailingComma ? "," : "",
|
||||
ifBreak(options.trailingComma ? "," : ""),
|
||||
ifBreak(!needsForcedTrailingComma && options.trailingComma ? "," : ""),
|
||||
options.bracketSpacing ? line : softline,
|
||||
"]"
|
||||
])
|
||||
|
|
|
@ -12,6 +12,8 @@ function f(
|
|||
) {}
|
||||
|
||||
declare class C { f(...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong): void; }
|
||||
|
||||
[superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong,,]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
declare class C {
|
||||
f(
|
||||
|
@ -31,5 +33,10 @@ declare class C {
|
|||
...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong
|
||||
): void,
|
||||
}
|
||||
|
||||
[
|
||||
superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong,
|
||||
,
|
||||
];
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -11,3 +11,5 @@ function f(
|
|||
) {}
|
||||
|
||||
declare class C { f(...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong): void; }
|
||||
|
||||
[superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong,,]
|
||||
|
|
Loading…
Reference in New Issue