-
Notifications
You must be signed in to change notification settings - Fork 47.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: react-hooks/exhaustive-deps reports a TypeScript type via typeof as a dependency #19327
Comments
RebeccaStevens
added
the
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
label
Jul 12, 2020
rickhanlonii
added
Component: ESLint Rules
Component: Hooks
good first issue
and removed
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
labels
Jul 13, 2020
Oh nice find @RebeccaStevens, confirmed. Any interest in working on a PR? |
Looks, like it is. Sorry for the dupe. |
No worry! Let's keep this open in case it's slightly different and to make sure we add a test case for this specific example 👍 |
@delca85 fixed this in #19316. If you find other similar issues, please report them too! Thanks.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
react-hooks/exhaustive-deps reports a missing dependency when a variable is used purely for it's type.
Once the typescript code has been transpiled, that variable will no longer be referenced in that part of the code and thus it's not a dependency.
React version: [email protected]
Eslint Plugin version: [email protected]
Steps To Reproduce
typeof x
Link to code example: https://codesandbox.io/s/late-sun-rpws4?file=/src/App.tsx
The current behavior
An eslint error such as the following occurs:
react-hooks/exhaustive-deps - "React Hook useEffect has a missing dependency: ..."
The expected behavior
No error should occur.
The text was updated successfully, but these errors were encountered: