Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(es/resolver): Ignore qualifiers of TsImportType #8299

Merged
merged 8 commits into from
Nov 20, 2023
10 changes: 8 additions & 2 deletions crates/swc_ecma_transforms_base/src/resolver/mod.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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>;
Original file line number Diff line number Diff line change
@@ -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;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously:

export type MyType__2 = import("./deps.ts").MyClass__2;

export type MyType2__2 = import("./deps.ts").MyClass__0<MyClass__2>;
Loading