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/transform_base): reset in_type flag correctly #6597

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/swc_ecma_transforms_base/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,10 @@ impl<'a> VisitMut for Resolver<'a> {
// Always resolve the import declaration identifiers even if it's type only.
// We need to analyze these identifiers for type stripping purposes.
self.ident_type = IdentType::Binding;
let old_in_type = self.in_type;
self.in_type = n.type_only;
n.visit_mut_children_with(self);
self.in_type = old_in_type;
}

fn visit_mut_import_named_specifier(&mut self, s: &mut ImportNamedSpecifier) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as F from "foo";
import type { Thing } from "anywhere";
console.log(F)

export const inner = <F>(a: F) => {
console.log(F)
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as F__1 from "foo";
import { Thing__1 } from "anywhere";
console.log(F__1);
export const inner__1 = <F__3>(a__3: F__3)=>{
console.log(F__1);
};