Validate importKind and ensure code generation exists.
This commit is contained in:
parent
2e6713209c
commit
80a757819f
@ -1,6 +1,11 @@
|
||||
import * as t from "babel-types";
|
||||
|
||||
export function ImportSpecifier(node: Object) {
|
||||
if (node.importKind === "type" || node.importKind === "typeof") {
|
||||
this.word(node.importKind);
|
||||
this.space();
|
||||
}
|
||||
|
||||
this.print(node.imported, node);
|
||||
if (node.local && node.local.name !== node.imported.name) {
|
||||
this.space();
|
||||
|
||||
@ -97,6 +97,10 @@ import type { foo as bar } from "baz";
|
||||
import type from "foo";
|
||||
import type, { foo } from "bar";
|
||||
import type * as namespace from "bar";
|
||||
import { type Foo } from "bar";
|
||||
import { typeof Foo } from "bar";
|
||||
import { type Foo as Bar } from "bar";
|
||||
import { typeof Foo as Bar } from "bar";
|
||||
export type { foo };
|
||||
export type { bar } from "bar";
|
||||
export interface baz { p: number };
|
||||
|
||||
@ -101,6 +101,10 @@ import type { foo as bar } from "baz";
|
||||
import type from "foo";
|
||||
import type, { foo } from "bar";
|
||||
import type * as namespace from "bar";
|
||||
import { type Foo } from "bar";
|
||||
import { typeof Foo } from "bar";
|
||||
import { type Foo as Bar } from "bar";
|
||||
import { typeof Foo as Bar } from "bar";
|
||||
export type { foo };
|
||||
export type { bar } from "bar";
|
||||
export interface baz { p: number };
|
||||
|
||||
@ -227,6 +227,10 @@ defineType("ImportSpecifier", {
|
||||
},
|
||||
imported: {
|
||||
validate: assertNodeType("Identifier")
|
||||
},
|
||||
importKind: {
|
||||
// Handle Flowtype's extension "import {typeof foo} from"
|
||||
validate: assertOneOf(null, "type", "typeof")
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user