diff --git a/crates/oxc_semantic/src/builder.rs b/crates/oxc_semantic/src/builder.rs index 01af805d74121..5fb8865f972f4 100644 --- a/crates/oxc_semantic/src/builder.rs +++ b/crates/oxc_semantic/src/builder.rs @@ -442,6 +442,9 @@ impl<'a> SemanticBuilder<'a> { // If the symbol is a value symbol and reference flag is not type-only, remove the type flag. if symbol_flag.is_value() && !flag.is_type_only() { *self.symbols.references[*id].flag_mut() -= ReferenceFlag::Type; + } else { + // If the symbol is a type symbol and reference flag is not type-only, remove the value flag. + *self.symbols.references[*id].flag_mut() -= ReferenceFlag::Value; } // import type { T } from './mod'; type A = typeof T diff --git a/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/equals3-type.snap b/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/equals3-type.snap index aab4be670cbc6..6eda2799cf581 100644 --- a/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/equals3-type.snap +++ b/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/equals3-type.snap @@ -24,7 +24,7 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/equals3- "node": "TSInterfaceDeclaration", "references": [ { - "flag": "ReferenceFlag(Read | Type)", + "flag": "ReferenceFlag(Type)", "id": 0, "name": "Foo", "node_id": 11 diff --git a/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named2-type.snap b/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named2-type.snap index 0933fd799ccee..8ba38319647ed 100644 --- a/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named2-type.snap +++ b/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named2-type.snap @@ -24,7 +24,7 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named2-t "node": "TSTypeAliasDeclaration", "references": [ { - "flag": "ReferenceFlag(Read | Type)", + "flag": "ReferenceFlag(Type)", "id": 0, "name": "A", "node_id": 8 diff --git a/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named3-type.snap b/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named3-type.snap index f65c9f2d9c7ff..ef7516964bb6c 100644 --- a/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named3-type.snap +++ b/crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named3-type.snap @@ -24,7 +24,7 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named3-t "node": "TSTypeAliasDeclaration", "references": [ { - "flag": "ReferenceFlag(Read | Type)", + "flag": "ReferenceFlag(Type)", "id": 0, "name": "V", "node_id": 8