Skip to content

Commit 29ba05d

Browse files
authoredDec 7, 2022
fix(es/resolver): Reset in_type flag correctly (#6597)
1 parent 9cc5b92 commit 29ba05d

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed
 

‎crates/swc_ecma_transforms_base/src/resolver/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -974,8 +974,10 @@ impl<'a> VisitMut for Resolver<'a> {
974974
// Always resolve the import declaration identifiers even if it's type only.
975975
// We need to analyze these identifiers for type stripping purposes.
976976
self.ident_type = IdentType::Binding;
977+
let old_in_type = self.in_type;
977978
self.in_type = n.type_only;
978979
n.visit_mut_children_with(self);
980+
self.in_type = old_in_type;
979981
}
980982

981983
fn visit_mut_import_named_specifier(&mut self, s: &mut ImportNamedSpecifier) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as F from "foo";
2+
import type { Thing } from "anywhere";
3+
console.log(F)
4+
5+
export const inner = <F>(a: F) => {
6+
console.log(F)
7+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import * as F__1 from "foo";
2+
import { Thing__1 } from "anywhere";
3+
console.log(F__1);
4+
export const inner__1 = <F__3>(a__3: F__3)=>{
5+
console.log(F__1);
6+
};

0 commit comments

Comments
 (0)
Please sign in to comment.