Issue 1:
This bug is likely a very close sibling of #19327, only this time it is for casting as T. I can't understand the line that fixed it (this specifically), but am happy to help write the rest of the PR's tests if someone can help with the fix for this one.

React version: 16.13.1 (latest)

eslint-plugin-react-hooks version: 4.1.0 (latest)

Steps To Reproduce

Cast a variable to a type in a hook callback.

Link to code example:

https://codesandbox.io/s/admiring-tharp-cbq0d?file=/src/App.tsx

type Foo = "Bar";

export default function App() {
const callback = React.useCallback(() => {
// this is the offending line:
const foo = "Foo" as Foo;
return foo;
}, []);
return <div onClick={callback} />;
}

The current behavior

React Hook React.useCallback has a missing dependency: 'Foo'. Either include it or remove the dependency array.eslintreact-hooks/exhaustive-deps

The expected behavior

No error, a type cannot be a dependency.

Issue 2:
Describe what you were doing when the bug occurred:

1.

2.

3.

Please do not remove the text below this line

DevTools version: 4.13.0-2a7bb41548

Call stack: at store_Store.getElementAtIndex (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:22067:35)

at store_Store.getElementIDAtIndex (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:22083:26)

at chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:29665:63

at List.render (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:23789:18)

at Hi (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:13937:76)

at Gi (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:13928:10)

at uk (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:16676:86)

at tk (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:16193:11)

at qk (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:16185:23)

at jk (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:16169:5)

Component stack: at List (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:23484:30)

at div

at AutoSizer (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:3642:5)

at div

at div

at Tree_Tree (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:29426:47)

at div

at div

at OwnersListContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:28575:3)

at SettingsModalContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:29016:3)

at Components_Components (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:34836:52)

at ErrorBoundary_ErrorBoundary (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:30336:5)

at PortaledContent (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:30416:5)

at div

at div

at ProfilerContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:34462:3)

at TreeContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:25252:3)

at SettingsContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:25855:3)

at ModalDialogContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:30558:3)

at DevTools_DevTools (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37572:3)