title: Function return type mismatching with TypeScript
body: <p>I can't understand it. I am knew to TypeScript and I am trying to stick to its recommendations as much as possible but this one makes no sense to me.</p>
  
  <p><a href="https://i.stack.imgur.com/fYQmQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fYQmQ.png" alt="See how TypeScript tells about an issue with the return type"></a></p>
  
  <p>Reading the tip, I see the definition of type <code>EffectCallback</code> which is, among other things:</p>
  
  <pre><code>type EffectCallback = (() =&gt; void)
  </code></pre>
  
  <p>Just to see if it makes any difference, I put the <em>definition</em> of the type directly and as you can see, it doesn't trigger TypeScript anymore.</p>
  
  <p><a href="https://i.stack.imgur.com/nHS9g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nHS9g.png" alt="enter image description here"></a></p>
  
  <p>What am I missing?</p>
  
  <p>And another thing is, according to what TypeScript tells me, <code>useEffect</code> expects an <code>EffectCallback</code>, which is at best a function that returns <code>void</code> as a parameter.</p>
  
  <p><a href="https://i.stack.imgur.com/MXoyA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MXoyA.png" alt="TypeScript tells us &lt;code&gt;useEffect&lt;/code&gt; expecs an EffectCallback"></a></p>
  
  <p>The thing is that according to <a href="https://reactjs.org/docs/hooks-reference.html#useeffect" rel="nofollow noreferrer">React documentation about <code>useEffect</code></a>, I can pass a function that returns a function. React uses this function for cleanup purposes.</p>
  
  <p>My guts tell me there is one small thing I can't get my finger on that would otherwise allow me to figure this out! </p>