fix(transformer/typescript): incorrect eliminate exports when the referenced symbol is both value and type (#4507)

This commit is contained in:
Dunqing 2024-07-28 00:11:29 +08:00 committed by GitHub
parent 963a2d1b85
commit ecdee88cfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View file

@ -87,7 +87,7 @@ impl<'a> TypeScriptAnnotations<'a> {
ident.reference_id.get().is_some_and(|id| {
ctx.symbols().references[id].symbol_id().is_some_and(
|symbol_id| {
ctx.symbols().get_flag(symbol_id).is_type()
!ctx.symbols().get_flag(symbol_id).is_value()
},
)
})

View file

@ -8,4 +8,10 @@ namespace Name {
export const Q = 0;
}
export { Im, Ok, Foo, Bar, Func, Baz, Baq, Name };
export { Im, Ok, Foo, Bar, Func, Baz, Baq, Name };
type T = number;
function T(): T {
return 123;
}
export { T }

View file

@ -6,4 +6,10 @@ let Name;
(function(_Name) {
const Q = _Name.Q = 0;
})(Name || (Name = {}));
export { Im, Ok, Foo, Bar, Func, Name };
function T() {
return 123;
}
export { T }