Skip to content

Commit

Permalink
fix: Handle export { type foo } as inType (#15494)
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Mar 14, 2023
1 parent 216bed0 commit 9e67898
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/babel-plugin-transform-typescript/src/index.ts
Expand Up @@ -24,9 +24,12 @@ function isInType(path: NodePath) {
);
case "ExportSpecifier":
return (
// export { type foo };
path.parent.exportKind === "type" ||
// export type { foo };
// @ts-expect-error: DeclareExportDeclaration does not have `exportKind`
(path.parentPath as NodePath<t.ExportSpecifier>).parent.exportKind ===
"type"
"type"
);
default:
return false;
Expand Down
@@ -0,0 +1,4 @@
import { foo, bar, type baz } from "Foo";
export { type foo };
export type { bar };
export { baz };
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,4 @@
import { foo, bar, type baz } from "Foo";
export { type foo };
export type { bar };
export { baz };
@@ -0,0 +1,8 @@
{
"plugins": [[
"transform-typescript",
{
"onlyRemoveTypeImports": true
}
]]
}
@@ -0,0 +1,2 @@
import { foo, bar } from "Foo";
export {};

0 comments on commit 9e67898

Please sign in to comment.