Repository: jlongster/prettier (js)

Issue:
Incorrect Flow type removal for imports
The following import statement: 

```js
import { Foo, type Baz } from "../module";
```

is converted wrongly into:

```js
import { Foo, Baz } from "../module";
```

Flow introduced this type syntax in imports in version 0.38.0 and it does not seem to be supported in prettier yet.

Pull request description:
Ensure importKind is printed
Fixes #713 

Patch:
diff --git a/src/printer.js b/src/printer.js
index 0acad6736..e8bfe91be 100644
--- a/src/printer.js
+++ b/src/printer.js
@@ -376,6 +376,10 @@ function genericPrintNoParens(path, options, print) {
       return join(" ", parts);
     case "ImportSpecifier":
       if (n.imported) {
+        if (n.importKind) {
+          parts.push(path.call(print, "importKind"), " ");
+        }
+
         parts.push(path.call(print, "imported"));
 
         if (n.local && n.local.name !== n.imported.name) {


Test patch:
diff --git a/tests/flow/import_type/__snapshots__/jsfmt.spec.js.snap b/tests/flow/import_type/__snapshots__/jsfmt.spec.js.snap
index 0beb91ee7..059cd220d 100644
--- a/tests/flow/import_type/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/flow/import_type/__snapshots__/jsfmt.spec.js.snap
@@ -345,6 +345,21 @@ function foo() {
 "
 `;
 
+exports[`test import_type_specifier.js 1`] = `
+"/**
+ * @flow
+ */
+
+import { Foo, type Baz } from \"../module\";
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+/**
+ * @flow
+ */
+
+import { Foo, type Baz } from \"../module\";
+"
+`;
+
 exports[`test issue-359.js 1`] = `
 "/* @flow */
 
diff --git a/tests/flow/import_type/import_type_specifier.js b/tests/flow/import_type/import_type_specifier.js
new file mode 100644
index 000000000..4e5d1bfae
--- /dev/null
+++ b/tests/flow/import_type/import_type_specifier.js
@@ -0,0 +1,5 @@
+/**
+ * @flow
+ */
+
+import { Foo, type Baz } from "../module";