Temporary fix comments inside of flow type spread (#1716)

This is breaking on fb code. While benjamn/ast-types#221 is getting merged in ast-type, we can add it in prettier so it fixes the issue.

Fixes #1632
master
Christopher Chedeau 2017-05-24 15:21:30 -07:00 committed by GitHub
parent 71a39d2512
commit a6068c0532
4 changed files with 20 additions and 0 deletions

View File

@ -8,6 +8,13 @@ module.exports = function(fork) {
const or = types.Type.or;
const defaults = fork.use(require("ast-types/lib/shared")).defaults;
// Putting it here while it's being merged upstream
// https://github.com/benjamn/ast-types/pull/221
def("ObjectTypeSpreadProperty")
.bases("Node")
.build("argument")
.field("argument", def("Type"));
// Ambient
def("TSAmbientVariableDefinition").bases("VariableDeclaration");

View File

@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`comments.js 1`] = `
type X = {...Y/**/};
type X = {/**/...Y};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type X = { ...Y /**/ };
type X = { /**/ ...Y };
`;

View File

@ -0,0 +1,2 @@
type X = {...Y/**/};
type X = {/**/...Y};

View File

@ -0,0 +1 @@
run_spec(__dirname, null, ["babylon"]);