Use ifBreak instead of shouldBreak (#2063)
shouldBreak is only a heuristic to enforce a break, if it breaks "naturally", then it won't be applied. Fixes #2055master
parent
753ff5f0ac
commit
939734b75e
|
@ -840,7 +840,7 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
);
|
);
|
||||||
const separator = n.type === "TSInterfaceBody" ||
|
const separator = n.type === "TSInterfaceBody" ||
|
||||||
n.type === "TSTypeLiteral"
|
n.type === "TSTypeLiteral"
|
||||||
? shouldBreak ? semi : ";"
|
? ifBreak(semi, ";")
|
||||||
: ",";
|
: ",";
|
||||||
const fields = [];
|
const fields = [];
|
||||||
const leftBrace = n.exact ? "{|" : "{";
|
const leftBrace = n.exact ? "{|" : "{";
|
||||||
|
|
|
@ -36,7 +36,17 @@ interface InlineMultiple { x: string; y: string }
|
||||||
|
|
||||||
exports[`type.js 1`] = `
|
exports[`type.js 1`] = `
|
||||||
type A = {disabled?: boolean, error?: string}
|
type A = {disabled?: boolean, error?: string}
|
||||||
|
|
||||||
|
const foo: {aasdf?: string; asdf?: number; foob?: string; zzz?: string; yyy: string} = {}
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
type A = { disabled?: boolean; error?: string }
|
type A = { disabled?: boolean; error?: string }
|
||||||
|
|
||||||
|
const foo: {
|
||||||
|
aasdf?: string
|
||||||
|
asdf?: number
|
||||||
|
foob?: string
|
||||||
|
zzz?: string
|
||||||
|
yyy: string
|
||||||
|
} = {}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
type A = {disabled?: boolean, error?: string}
|
type A = {disabled?: boolean, error?: string}
|
||||||
|
|
||||||
|
const foo: {aasdf?: string; asdf?: number; foob?: string; zzz?: string; yyy: string} = {}
|
||||||
|
|
Loading…
Reference in New Issue