Skip to content

Commit

Permalink
fix(es/resolver): Ignore qualifiers of TsImportType (#8299)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Nov 20, 2023
1 parent 8c3dc02 commit 2113bb3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/swc_ecma_transforms_base/src/resolver/mod.rs
Expand Up @@ -510,8 +510,6 @@ impl<'a> VisitMut for Resolver<'a> {

typed_ref!(visit_mut_ts_infer_type, TsInferType);

typed_ref!(visit_mut_ts_import_type, TsImportType);

typed_ref!(visit_mut_ts_tuple_type, TsTupleType);

typed_ref!(visit_mut_ts_intersection_type, TsIntersectionType);
Expand Down Expand Up @@ -1304,6 +1302,14 @@ impl<'a> VisitMut for Resolver<'a> {
n.module_ref.visit_mut_with(self);
}

fn visit_mut_ts_import_type(&mut self, n: &mut TsImportType) {
if !self.config.handle_types {
return;
}

n.type_args.visit_mut_with(self);
}

fn visit_mut_ts_interface_decl(&mut self, n: &mut TsInterfaceDecl) {
// always resolve the identifier for type stripping purposes
let old_in_type = self.in_type;
Expand Down
@@ -0,0 +1,7 @@
import { MyClass } from "./MyClass.ts";
const test = new MyClass();

// MyClass identifier here should be different
// than the one above.
export type MyType = import("./deps.ts").MyClass;
export type MyType2 = import("./deps.ts").MyClass<MyClass>;
@@ -0,0 +1,4 @@
import { MyClass__2 } from "./MyClass.ts";
const test__2 = new MyClass__2();
export type MyType__2 = import("./deps.ts").MyClass__0;
export type MyType2__2 = import("./deps.ts").MyClass__0<MyClass__2>;

0 comments on commit 2113bb3

Please sign in to comment.