From 96602bf98e19518eae57d101fc92b3a3130c2df1 Mon Sep 17 00:00:00 2001 From: Dunqing <29533304+Dunqing@users.noreply.github.com> Date: Mon, 29 Jul 2024 03:39:20 +0000 Subject: [PATCH] refactor(transformer/typescript): determine whether to remove `ExportSpeicifer` by `ReferenceFlags` (#4513) After https://github.com/oxc-project/oxc/pull/4511. We can determine if a binding is a type binding just by the `ReferenceFlags`. We can make it even better with `ident.reference_flag` once #4512 is sorted out --- crates/oxc_transformer/src/typescript/annotations.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/oxc_transformer/src/typescript/annotations.rs b/crates/oxc_transformer/src/typescript/annotations.rs index fd37980f5fa9e..d4594c79da9cc 100644 --- a/crates/oxc_transformer/src/typescript/annotations.rs +++ b/crates/oxc_transformer/src/typescript/annotations.rs @@ -85,11 +85,7 @@ impl<'a> TypeScriptAnnotations<'a> { &specifier.local { 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_value() - }, - ) + ctx.symbols().get_reference(id).is_type() }) } else { false