Skip to content

Commit

Permalink
fix(es/resolver): Reset in_type flag correctly (#6597)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyf0 committed Dec 7, 2022
1 parent 9cc5b92 commit 29ba05d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/swc_ecma_transforms_base/src/resolver/mod.rs
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
@@ -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)
};
@@ -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);
};

0 comments on commit 29ba05d

Please sign in to comment.