mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(linter): ignore type references in no-undef (#7670)
fixes #7007 fixes #7008
This commit is contained in:
parent
a0973dcb5a
commit
6ae178e0b9
1 changed files with 8 additions and 1 deletions
|
|
@ -50,6 +50,11 @@ impl Rule for NoUndef {
|
|||
for reference_id_list in ctx.scopes().root_unresolved_references_ids() {
|
||||
for reference_id in reference_id_list {
|
||||
let reference = symbol_table.get_reference(reference_id);
|
||||
|
||||
if reference.is_type() {
|
||||
return;
|
||||
}
|
||||
|
||||
let name = ctx.semantic().reference_name(reference);
|
||||
|
||||
if ctx.env_contains_var(name) {
|
||||
|
|
@ -153,7 +158,9 @@ fn test() {
|
|||
"class C { static { function a() {} a; } }",
|
||||
"class C { static { a; function a() {} } }",
|
||||
"String;Array;Boolean;",
|
||||
"function resolve<T>(path: string): T { return { path } as T; }"
|
||||
"function resolve<T>(path: string): T { return { path } as T; }",
|
||||
"let xyz: NodeListOf<HTMLElement>",
|
||||
"type Foo = Record<string, unknown>;"
|
||||
];
|
||||
|
||||
let fail = vec![
|
||||
|
|
|
|||
Loading…
Reference in a new issue