parent
f56f9e5e8f
commit
2ef169eb67
|
@ -816,9 +816,16 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
case "TSInterfaceBody":
|
case "TSInterfaceBody":
|
||||||
case "TSTypeLiteral": {
|
case "TSTypeLiteral": {
|
||||||
const isTypeAnnotation = n.type === "ObjectTypeAnnotation";
|
const isTypeAnnotation = n.type === "ObjectTypeAnnotation";
|
||||||
|
const shouldBreak =
|
||||||
|
n.type !== "ObjectPattern" &&
|
||||||
|
util.hasNewlineInRange(
|
||||||
|
options.originalText,
|
||||||
|
util.locStart(n),
|
||||||
|
util.locEnd(n)
|
||||||
|
);
|
||||||
const separator = n.type === "TSInterfaceBody" ||
|
const separator = n.type === "TSInterfaceBody" ||
|
||||||
n.type === "TSTypeLiteral"
|
n.type === "TSTypeLiteral"
|
||||||
? semi
|
? shouldBreak ? semi : ";"
|
||||||
: ",";
|
: ",";
|
||||||
const fields = [];
|
const fields = [];
|
||||||
const leftBrace = n.exact ? "{|" : "{";
|
const leftBrace = n.exact ? "{|" : "{";
|
||||||
|
@ -921,14 +928,6 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldBreak =
|
|
||||||
n.type !== "ObjectPattern" &&
|
|
||||||
util.hasNewlineInRange(
|
|
||||||
options.originalText,
|
|
||||||
util.locStart(n),
|
|
||||||
util.locEnd(n)
|
|
||||||
);
|
|
||||||
|
|
||||||
return group(content, { shouldBreak });
|
return group(content, { shouldBreak });
|
||||||
}
|
}
|
||||||
case "PropertyPattern":
|
case "PropertyPattern":
|
||||||
|
|
|
@ -7,6 +7,8 @@ interface MultiLine {
|
||||||
x: string;
|
x: string;
|
||||||
y: string;
|
y: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface InlineMultiple { x: string; y: string }
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
interface Inline { x: string }
|
interface Inline { x: string }
|
||||||
|
|
||||||
|
@ -15,4 +17,13 @@ interface MultiLine {
|
||||||
y: string
|
y: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface InlineMultiple { x: string; y: string }
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`type.js 1`] = `
|
||||||
|
type A = {disabled?: boolean, error?: string}
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
type A = { disabled?: boolean; error?: string }
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -4,3 +4,5 @@ interface MultiLine {
|
||||||
x: string;
|
x: string;
|
||||||
y: string;
|
y: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface InlineMultiple { x: string; y: string }
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
type A = {disabled?: boolean, error?: string}
|
Loading…
Reference in New Issue