diff --git a/package.json b/package.json index 30da52486..204b4849c 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "babylon": "7.0.0-beta.8", "chalk": "1.1.3", "esutils": "2.0.2", - "flow-parser": "0.40.0", + "flow-parser": "0.43.0", "get-stdin": "5.0.1", "glob": "7.1.1", "jest-validate": "19.0.0", diff --git a/src/printer.js b/src/printer.js index d9e1bc6d8..42354ddf2 100644 --- a/src/printer.js +++ b/src/printer.js @@ -265,6 +265,7 @@ function genericPrintNoParens(path, options, print) { case "SpreadProperty": case "SpreadPropertyPattern": case "RestElement": + case "ObjectTypeSpreadProperty": return concat([ "...", path.call(print, "argument"), diff --git a/tests/flow_type_spread/__snapshots__/jsfmt.spec.js.snap b/tests/flow_type_spread/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..a0f26bcca --- /dev/null +++ b/tests/flow_type_spread/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`spread.js 1`] = ` +"type TypeB = { ...TypeA }; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +type TypeB = { ...TypeA }; +" +`; + +exports[`spread.js 2`] = ` +"type TypeB = { ...TypeA }; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +type TypeB = { ...TypeA }; +" +`; diff --git a/tests/flow_type_spread/jsfmt.spec.js b/tests/flow_type_spread/jsfmt.spec.js new file mode 100644 index 000000000..29e013ea0 --- /dev/null +++ b/tests/flow_type_spread/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname); +run_spec(__dirname, {parser: 'flow'}); diff --git a/tests/flow_type_spread/spread.js b/tests/flow_type_spread/spread.js new file mode 100644 index 000000000..dd188e7dd --- /dev/null +++ b/tests/flow_type_spread/spread.js @@ -0,0 +1 @@ +type TypeB = { ...TypeA }; diff --git a/yarn.lock b/yarn.lock index 0681630f0..f11b9cc0c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -105,10 +105,6 @@ assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" -ast-types@0.8.18: - version "0.8.18" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.8.18.tgz#c8b98574898e8914e9d8de74b947564a9fe929af" - ast-types@0.9.8: version "0.9.8" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.8.tgz#6cb6a40beba31f49f20928e28439fc14a3dab078" @@ -469,10 +465,6 @@ color-name@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" -colors@>=0.6.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" - combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" @@ -754,13 +746,9 @@ find-up@^2.1.0: dependencies: locate-path "^2.0.0" -flow-parser@0.40.0: - version "0.40.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.40.0.tgz#b3444742189093323c4319c4fe9d35391f46bcbc" - dependencies: - ast-types "0.8.18" - colors ">=0.6.2" - minimist ">=0.2.0" +flow-parser@0.43.0: + version "0.43.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.43.0.tgz#e2b8eb1ac83dd53f7b6b04a7c35b6a52c33479b7" for-in@^0.1.5: version "0.1.6" @@ -1551,7 +1539,7 @@ minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@1.2.0, minimist@>=0.2.0, minimist@^1.1.1: +minimist@1.2.0, minimist@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"