diff --git a/src/printer.js b/src/printer.js index e617415e..cf35ad28 100644 --- a/src/printer.js +++ b/src/printer.js @@ -840,7 +840,7 @@ function genericPrintNoParens(path, options, print, args) { ); const separator = n.type === "TSInterfaceBody" || n.type === "TSTypeLiteral" - ? shouldBreak ? semi : ";" + ? ifBreak(semi, ";") : ","; const fields = []; const leftBrace = n.exact ? "{|" : "{"; diff --git a/tests/typescript_nosemi/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_nosemi/__snapshots__/jsfmt.spec.js.snap index 5c73500c..b2179330 100644 --- a/tests/typescript_nosemi/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_nosemi/__snapshots__/jsfmt.spec.js.snap @@ -36,7 +36,17 @@ interface InlineMultiple { x: string; y: string } exports[`type.js 1`] = ` type A = {disabled?: boolean, error?: string} + +const foo: {aasdf?: string; asdf?: number; foob?: string; zzz?: string; yyy: string} = {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type A = { disabled?: boolean; error?: string } +const foo: { + aasdf?: string + asdf?: number + foob?: string + zzz?: string + yyy: string +} = {} + `; diff --git a/tests/typescript_nosemi/type.js b/tests/typescript_nosemi/type.js index 6acd0ad5..5161f34e 100644 --- a/tests/typescript_nosemi/type.js +++ b/tests/typescript_nosemi/type.js @@ -1 +1,3 @@ type A = {disabled?: boolean, error?: string} + +const foo: {aasdf?: string; asdf?: number; foob?: string; zzz?: string; yyy: string} = {}