Skip to content

Commit 76891da

Browse files
committed
fix(linter/exhaustive-deps): false positive with ident used in type param (oxc-project#11812)
fixes oxc-project#11809
1 parent a8e4f01 commit 76891da

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/oxc_linter/src/rules/react/exhaustive_deps.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use oxc_ast::{
1111
Argument, ArrayExpressionElement, ArrowFunctionExpression, BindingPattern,
1212
BindingPatternKind, CallExpression, ChainElement, Expression, FormalParameters, Function,
1313
FunctionBody, IdentifierReference, MemberExpression, StaticMemberExpression,
14-
TSTypeAnnotation, TSTypeParameter, TSTypeReference, VariableDeclarationKind,
14+
TSTypeAnnotation, TSTypeParameterInstantiation, TSTypeReference, VariableDeclarationKind,
1515
VariableDeclarator,
1616
},
1717
match_expression,
@@ -1206,7 +1206,7 @@ impl<'a> Visit<'a> for ExhaustiveDepsVisitor<'a, '_> {
12061206
// noop
12071207
}
12081208

1209-
fn visit_ts_type_parameters(&mut self, _it: &oxc_allocator::Vec<'a, TSTypeParameter<'a>>) {
1209+
fn visit_ts_type_parameter_instantiation(&mut self, _it: &TSTypeParameterInstantiation<'a>) {
12101210
// noop
12111211
}
12121212

@@ -2471,6 +2471,7 @@ fn test() {
24712471
r"function Foo2() { useEffect(() => { foo() }, []); const foo = () => { bar() }; function bar () { foo() } }",
24722472
r"function MyComponent(props) { useEffect(() => { console.log(props.foo!.bar) }, [props.foo!.bar]) }",
24732473
r"function MyComponent(props) { useEffect(() => { console.log((props.foo).bar) }, [props.foo!.bar]) }",
2474+
r"function MyComponent(props) { const external = {}; const y = useMemo(() => { const z = foo<typeof external>(); return z; }, []) }",
24742475
];
24752476

24762477
let fail = vec![

0 commit comments

Comments
 (0)