Skip to content

Commit

Permalink
fix: Preserve import {type T} from 'x' when `onlyRemoveTypeImports:…
Browse files Browse the repository at this point in the history
…true` (#15349)

fix
  • Loading branch information
liuxingbaoyu committed Jan 15, 2023
1 parent c19d2f6 commit f9fbc25
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/babel-plugin-transform-typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export default declare((api, opts: Options) => {
}
}

if (isAllSpecifiersElided()) {
if (isAllSpecifiersElided() && !onlyRemoveTypeImports) {
stmt.remove();
} else {
for (const importPath of importsToRemove) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ import d, { d2 } from "d";
import e, { e3 as e4 } from "e";
import "f";
import "g";
import "k";
import { L2 } from "l";
;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "x";

0 comments on commit f9fbc25

Please sign in to comment.