Disallow import type { type a } from … (#305)
This commit is contained in:
parent
28c467e8fe
commit
999b655ca6
@ -1,6 +1,7 @@
|
||||
[ignore]
|
||||
.*/lib/.*
|
||||
.*/test/.*
|
||||
.*/build/.*
|
||||
|
||||
[include]
|
||||
|
||||
|
||||
@ -1223,6 +1223,10 @@ export default function (instance) {
|
||||
specifier.local = specifier.imported.__clone();
|
||||
}
|
||||
|
||||
if (node.importKind !== "value" && specifier.importKind !== null) {
|
||||
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`");
|
||||
}
|
||||
|
||||
this.checkLVal(specifier.local, true, undefined, "import specifier");
|
||||
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
|
||||
};
|
||||
|
||||
2
test/fixtures/flow/type-imports/invalid-import-type-shorthand/actual.js
vendored
Normal file
2
test/fixtures/flow/type-imports/invalid-import-type-shorthand/actual.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import typeof {typeof t} from "foo";
|
||||
import type {type t} from "foo";
|
||||
3
test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json
vendored
Normal file
3
test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json
vendored
Normal 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:15)"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user