mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(linter/no-unused-vars): false positives when variable and type have same name (#8465)
close: #8236
This commit is contained in:
parent
1d6e84dd33
commit
2be1e82964
2 changed files with 7 additions and 2 deletions
|
|
@ -1083,7 +1083,10 @@ fn test_namespaces() {
|
|||
|
||||
#[test]
|
||||
fn test_type_aliases() {
|
||||
let pass = vec!["type Foo = string; export default Foo;"];
|
||||
let pass = vec![
|
||||
"type Foo = string; export default Foo;",
|
||||
"const a = { hello: 'world' }; export type a = typeof a;",
|
||||
];
|
||||
|
||||
let fail = vec![
|
||||
// usages within own declaration do not count
|
||||
|
|
|
|||
|
|
@ -291,7 +291,9 @@ impl<'a> Symbol<'_, 'a> {
|
|||
| AstKind::ExportNamedDeclaration(_)
|
||||
| AstKind::ExportDefaultDeclaration(_)
|
||||
| AstKind::ExportAllDeclaration(_)
|
||||
| AstKind::Program(_) => {
|
||||
| AstKind::Program(_)
|
||||
// It refers to value bindings, not types
|
||||
| AstKind::TSTypeQuery(_) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue