diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index e03565597..663126784 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -2675,8 +2675,16 @@ function printPathNoParens(path, options, print, args) { case "ObjectTypeProperty": { const variance = getFlowVariance(n); + let modifier = ""; + + if (n.proto) { + modifier = "proto "; + } else if (n.static) { + modifier = "static "; + } + return concat([ - n.static ? "static " : "", + modifier, isGetterOrSetter(n) ? n.kind + " " : "", variance || "", printPropertyKey(path, options, print), diff --git a/tests/flow_proto_props/__snapshots__/jsfmt.spec.js.snap b/tests/flow_proto_props/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..52e130ec1 --- /dev/null +++ b/tests/flow_proto_props/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`proto_props.js 1`] = ` +declare class A { proto: T; } +declare class B { proto x: T; } +declare class C { proto +x: T; } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +declare class A { proto: T } +declare class B { proto x: T } +declare class C { proto +x: T } + +`; diff --git a/tests/flow_proto_props/jsfmt.spec.js b/tests/flow_proto_props/jsfmt.spec.js new file mode 100644 index 000000000..b9a908981 --- /dev/null +++ b/tests/flow_proto_props/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["flow"]); diff --git a/tests/flow_proto_props/proto_props.js b/tests/flow_proto_props/proto_props.js new file mode 100644 index 000000000..94e6ab9f7 --- /dev/null +++ b/tests/flow_proto_props/proto_props.js @@ -0,0 +1,3 @@ +declare class A { proto: T; } +declare class B { proto x: T; } +declare class C { proto +x: T; }