Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Commit

Permalink
Address comments on flow type imports (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
danez authored Jan 20, 2017
1 parent d5cd2c3 commit 55df663
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/plugins/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,10 @@ export default function (instance) {
specifier.local = specifier.imported.__clone();
}

if (node.importKind !== "value" && specifier.importKind !== null) {
if (
(node.importKind === "type" || node.importKind === "typeof") &&
(specifier.importKind === "type" || specifier.importKind === "typeof")
) {
this.raise(firstIdentLoc, "`The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements`");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import type {type t} from "foo";
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"throws": "`The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements` (1:13)"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import typeof {typeof t} from "foo";
import type {type t} from "foo";

0 comments on commit 55df663

Please sign in to comment.