mirror of
https://github.com/swc-project/swc.git
synced 2024-11-29 11:47:21 +03:00
fix(es/typescript): Correctly handle deep import chains (#9487)
**Related issue:** - Closes https://github.com/swc-project/swc/issues/9486
This commit is contained in:
parent
1121bc0dc1
commit
50d70d35d0
5
.changeset/silver-taxis-do.md
Normal file
5
.changeset/silver-taxis-do.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
swc_ecma_transforms_typescript: patch
|
||||
---
|
||||
|
||||
fix(es/typescript): Correctly handle deep import chains
|
@ -121,10 +121,10 @@ impl UsageCollect {
|
||||
|
||||
let mut new_usage = AHashSet::default();
|
||||
for id in &self.id_usage {
|
||||
let mut entry = self.import_chain.remove_entry(id);
|
||||
while let Some((id, next)) = entry {
|
||||
new_usage.insert(next);
|
||||
entry = self.import_chain.remove_entry(&id);
|
||||
let mut next = self.import_chain.remove(id);
|
||||
while let Some(id) = next {
|
||||
next = self.import_chain.remove(&id);
|
||||
new_usage.insert(id);
|
||||
}
|
||||
if self.import_chain.is_empty() {
|
||||
break;
|
||||
|
@ -0,0 +1,5 @@
|
||||
import { ns1 } from '../anotherFile';
|
||||
import ns2 = ns1.ns2;
|
||||
import Class = ns2.Class;
|
||||
|
||||
const a = new Class(5);
|
@ -0,0 +1,4 @@
|
||||
import { ns1 } from '../anotherFile';
|
||||
const ns2 = ns1.ns2;
|
||||
const Class = ns2.Class;
|
||||
const a = new Class(5);
|
Loading…
Reference in New Issue
Block a user