Address comments on flow type imports (#312)

This commit is contained in:
Daniel Tschinder 2017-01-20 22:20:13 +01:00 committed by GitHub
parent d5cd2c3231
commit 55df6631fa
4 changed files with 8 additions and 2 deletions

View File

@ -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`");
}

View File

@ -0,0 +1 @@
import type {type t} from "foo";

View File

@ -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)"
}

View File

@ -1,2 +1 @@
import typeof {typeof t} from "foo";
import type {type t} from "foo";