react
                                
                                 react copied to clipboard
                                
                                    react copied to clipboard
                            
                            
                            
                        Bug: eslint-plugin-react-hooks does not support TypeScript "satisfies" operator
React version: 18.2.0
Steps To Reproduce
- Install [email protected], [email protected] and latest [email protected]
- Enable "react-hooks/exhaustive-deps" rule
- Use "satisfies" operator for a callback function passed:
// Error: React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead. eslintreact-hooks/exhaustive-deps
const onClick = useCallback(
  (() => {
    return true;
  }) satisfies () => true,
  // Expected to see eslint error: The true literal is not a valid dependency because it never changes. You can safely remove it. eslintreact-hooks/exhaustive-deps
  [true]
);
Link to code example: Here I created a repo with the minimal demo to reproduce the issue, CodeSandbox does not allow to configure eslint properly: https://github.com/Egor-Koldasov/eslint-plugin-react-hooks-satisfies-error
The current behavior
Plugin shows the error and doesn't check actual dependencies passed to the useCallback:
React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead. eslintreact-hooks/exhaustive-deps
The expected behavior
It should work exactly the same way as it works without "satisfies" operator used. No error "received a function whose dependencies are unknown" and dependencies passed are successfully checked.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
@Egor-Koldasov Can you double check if this still reproduces with the latest version of @typescript-eslint/*?
This still happens with the latest versions of both @typescript-eslint/* and eslint-plugin-react-hooks. See https://stackblitz.com/edit/vitejs-vite-4arsvz?file=package.json
Any ideas @eps1lon ?
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!