title: type for useRef if used with setInterval, react-typescript
body: <p>I am doing a simple animation in a next.js app.</p>
  <pre><code>let flipInterval = useRef();
  
  
  
  const startAnimation = () =&gt; {
      flipInterval.current = setInterval(() =&gt; {
        setIsFlipping((prevFlipping) =&gt; !prevFlipping);
      }, 10000);
    };
  </code></pre>
  <p>for <code>flipInterval.current</code> I am getting &quot;Type 'Timeout' is not assignable to type 'undefined'&quot;. So i checked how to use Timeout type, I see that people are using  but thats not working.</p>
  <pre><code> let flipInterval = useRef&lt;typeof window.settimeout&gt;();
  </code></pre>
  <p>I also passed number <code>useRef&lt;number&gt;()</code> this time I am getting &quot;Type 'Timeout' is not assignable to type 'number'&quot;</p>
  <p>this did not work neither</p>
  <pre><code>  let flipInterval = useRef&lt;typeof window.setInterval&gt;();
  </code></pre>