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: react@16.13.1
Eslint Plugin version: eslint-plugin-react-hooks@4.0.7
Steps To Reproduce
- Have some typed variable declared in the component.
- Within a hook callback, refer to that variable's type via
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.