mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(semantic): generic passed to typeof not counted as a reference (#4499)
This commit is contained in:
parent
40cafb8c61
commit
ef0e953702
3 changed files with 21 additions and 2 deletions
|
|
@ -1787,6 +1787,11 @@ impl<'a> SemanticBuilder<'a> {
|
|||
// ^^^^^^^^
|
||||
self.current_reference_flag = ReferenceFlag::Read | ReferenceFlag::TSTypeQuery;
|
||||
}
|
||||
AstKind::TSTypeParameterInstantiation(_) => {
|
||||
// type A<T> = typeof a<T>;
|
||||
// ^^^ avoid treat T as a value and TSTypeQuery
|
||||
self.current_reference_flag -= ReferenceFlag::Read | ReferenceFlag::TSTypeQuery;
|
||||
}
|
||||
AstKind::TSTypeName(_) => {
|
||||
match self.nodes.parent_kind(self.current_node_id) {
|
||||
Some(
|
||||
|
|
|
|||
|
|
@ -52,7 +52,14 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/instantiation-e
|
|||
"id": 4,
|
||||
"name": "T",
|
||||
"node": "TSTypeParameter",
|
||||
"references": []
|
||||
"references": [
|
||||
{
|
||||
"flag": "ReferenceFlag(Type)",
|
||||
"id": 3,
|
||||
"name": "T",
|
||||
"node_id": 31
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,14 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/type-declaratio
|
|||
"id": 4,
|
||||
"name": "T",
|
||||
"node": "TSTypeParameter",
|
||||
"references": []
|
||||
"references": [
|
||||
{
|
||||
"flag": "ReferenceFlag(Type)",
|
||||
"id": 3,
|
||||
"name": "T",
|
||||
"node_id": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue