mirror of
https://github.com/swc-project/swc.git
synced 2025-01-03 11:01:52 +03:00
fix(es/typescript): Preserve referenced imports for namespace (#4759)
This commit is contained in:
parent
ae39b02df3
commit
065b2a514f
@ -1658,6 +1658,17 @@ where
|
||||
match name {
|
||||
TsEntityName::Ident(ref i) => {
|
||||
entry.maybe_dependency = Some(i.clone());
|
||||
// Eagerly update referenced idents for the concrete exports
|
||||
// resolves https://github.com/swc-project/swc/issues/4481, if we
|
||||
// know reference exists & reexports.
|
||||
// when referenced idents are scoped in ts namespace, its references
|
||||
// is updated _after_ visiting import decl which strips out imports
|
||||
// already.
|
||||
if n.is_export && !n.is_type_only {
|
||||
let entry =
|
||||
self.scope.referenced_idents.entry(i.to_id()).or_default();
|
||||
entry.has_concrete = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
TsEntityName::TsQualifiedName(ref q) => name = &q.left,
|
||||
|
@ -0,0 +1,7 @@
|
||||
import * as I from "./ABC";
|
||||
|
||||
export namespace IE {
|
||||
export import A = I.A;
|
||||
export import C = I.C;
|
||||
export import D = I.D;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import * as I from "./ABC";
|
||||
export var IE;
|
||||
(function(IE1) {
|
||||
var A = I.A;
|
||||
IE1.A = A;
|
||||
var C = I.C;
|
||||
IE1.C = C;
|
||||
var D = I.D;
|
||||
IE1.D = D;
|
||||
})(IE || (IE = {}));
|
Loading…
Reference in New Issue
Block a user