<p dir="auto">React version: 16.13.1</p>
<h2 dir="auto">Steps To Reproduce</h2>
<ol dir="auto">
<li>Create function with generic type parameter</li>
<li>Use that generic type parameter in <code class="notranslate">useCallback</code>, <code class="notranslate">useEffect</code> or <code class="notranslate">useMemo</code></li>
</ol>
<p dir="auto">Example:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export function useDocument&lt;TDocument&gt;(path: string, defaultValue: TDocument | undefined = undefined): TDocument | undefined {
	const [value, setValue] = useState&lt;TDocument | undefined&gt;(defaultValue);

	const onNext = useCallback((snapshot: FirebaseFirestoreTypes.DocumentSnapshot&lt;FirebaseFirestoreTypes.DocumentData&gt;) =&gt; {
		if (snapshot.exists) setValue(build&lt;TDocument&gt;(snapshot.data(), snapshot.id));
		else setValue(undefined);
	}, []);


	useEffect(() =&gt; firestore().doc(path).onSnapshot(onNext), [onNext, path]);

	return value;
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">function</span> <span class="pl-en">useDocument</span><span class="pl-c1">&lt;</span><span class="pl-smi">TDocument</span><span class="pl-c1">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">path</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-s1">defaultValue</span>: <span class="pl-smi">TDocument</span> <span class="pl-c1">|</span> <span class="pl-c1">undefined</span> <span class="pl-c1">=</span> <span class="pl-c1">undefined</span><span class="pl-kos">)</span>: <span class="pl-smi">TDocument</span> <span class="pl-c1">|</span> <span class="pl-c1">undefined</span> <span class="pl-kos">{</span>
	<span class="pl-k">const</span> <span class="pl-kos">[</span><span class="pl-s1">value</span><span class="pl-kos">,</span> <span class="pl-s1">setValue</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-en">useState</span><span class="pl-kos">&lt;</span><span class="pl-smi">TDocument</span> <span class="pl-c1">|</span> <span class="pl-c1">undefined</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">defaultValue</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

	<span class="pl-k">const</span> <span class="pl-s1">onNext</span> <span class="pl-c1">=</span> <span class="pl-en">useCallback</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">snapshot</span>: <span class="pl-smi">FirebaseFirestoreTypes</span><span class="pl-kos">.</span><span class="pl-smi">DocumentSnapshot</span><span class="pl-kos">&lt;</span><span class="pl-smi">FirebaseFirestoreTypes</span><span class="pl-kos">.</span><span class="pl-smi">DocumentData</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
		<span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">snapshot</span><span class="pl-kos">.</span><span class="pl-c1">exists</span><span class="pl-kos">)</span> <span class="pl-en">setValue</span><span class="pl-kos">(</span><span class="pl-en">build</span><span class="pl-kos">&lt;</span><span class="pl-smi">TDocument</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">snapshot</span><span class="pl-kos">.</span><span class="pl-en">data</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">snapshot</span><span class="pl-kos">.</span><span class="pl-c1">id</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
		<span class="pl-k">else</span> <span class="pl-en">setValue</span><span class="pl-kos">(</span><span class="pl-c1">undefined</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
	<span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>


	<span class="pl-en">useEffect</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-en">firestore</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">doc</span><span class="pl-kos">(</span><span class="pl-s1">path</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">onSnapshot</span><span class="pl-kos">(</span><span class="pl-s1">onNext</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-kos">[</span><span class="pl-s1">onNext</span><span class="pl-kos">,</span> <span class="pl-s1">path</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

	<span class="pl-k">return</span> <span class="pl-s1">value</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/15199031/92776710-ce9d8200-f39f-11ea-84bb-3d03fb76f8f1.png"><img src="https://user-images.githubusercontent.com/15199031/92776710-ce9d8200-f39f-11ea-84bb-3d03fb76f8f1.png" alt="Screenshot 2020-09-10 at 19 57 06" style="max-width: 100%;"></a></p>
<h2 dir="auto">The current behavior</h2>
<p dir="auto">Shows error <code class="notranslate">React Hook useCallback has a missing dependency: 'TDocument'. Either include it or remove the dependency array.eslintreact-hooks/exhaustive-deps)</code></p>
<h2 dir="auto">The expected behavior</h2>
<p dir="auto">Should not show any errors, because it isn't possible to add types to the dependencies array (types don't exist at runtime!)</p>
<p dir="auto">React version: <code class="notranslate">16.13.1</code> (although this is related to the eslint plugin).</p>
<h2 dir="auto">Steps To Reproduce</h2>
<ol dir="auto">
<li>Install <code class="notranslate">eslint-plugin-react-hooks@4.1.0</code> with <code class="notranslate">@typescript-eslint/parser@4.0.1</code> in a TypeScript project.</li>
<li>Within your hook define a type, or cast a value to a certain type`
<div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const actions = useMemo(
	() =&gt; bindActionCreators(MultishiftActions, dispatch) as Partial&lt;Item&gt;,
	[dispatch],
);"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">actions</span> <span class="pl-c1">=</span> <span class="pl-en">useMemo</span><span class="pl-kos">(</span>
	<span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-en">bindActionCreators</span><span class="pl-kos">(</span><span class="pl-smi">MultishiftActions</span><span class="pl-kos">,</span> <span class="pl-s1">dispatch</span><span class="pl-kos">)</span> <span class="pl-k">as</span> <span class="pl-smi">Partial</span><span class="pl-kos">&lt;</span><span class="pl-smi">Item</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span>
	<span class="pl-kos">[</span><span class="pl-s1">dispatch</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
<span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
</li>
<li><code class="notranslate">eslint-plugin-react-hooks</code> responds with this error <code class="notranslate">React Hook useMemo has a missing dependency: Item. Either include it or remove the dependency array.</code></li>
</ol>

<p dir="auto">Link to code example: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="690407705" data-permission-text="Title is private" data-url="https://github.com/remirror/remirror/issues/619" data-hovercard-type="pull_request" data-hovercard-url="/remirror/remirror/pull/619/hovercard" href="https://github.com/remirror/remirror/pull/619">remirror/remirror/pull/619</a></p>
<ul dir="auto">
<li>Checkout the remirror codebase
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" git clone https://github.com/remirror/remirror
 git checkout typedoc"><pre class="notranslate"> git clone https://github.com/remirror/remirror
 git checkout typedoc</pre></div>
</li>
<li>Install the dependencies with <code class="notranslate">pnpm</code>. To setup <code class="notranslate">pnpm </code> run <code class="notranslate">npm i -g pnpm</code>.</li>
<li>Run the command <code class="notranslate">pnpm run lint:es</code> to lint the codebase.</li>
</ul>

<h2 dir="auto">The current behavior</h2>
<p dir="auto">Types are identified as missing dependencies within a hook and <a href="https://github.com/remirror/remirror/pull/619/checks?check_run_id=1058210430">CI fails</a>.</p>
<h2 dir="auto">The expected behavior</h2>
<p dir="auto">Types shouldn't be identified as missing dependencies.</p>