Skip to content

Commit

Permalink
fix(transformer/typescript): incorrect eliminate exports when the ref…
Browse files Browse the repository at this point in the history
…erenced symbol is both value and type (#4507)
  • Loading branch information
Dunqing authored Jul 27, 2024
1 parent 963a2d1 commit ecdee88
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/oxc_transformer/src/typescript/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

0 comments on commit ecdee88

Please sign in to comment.