title: How to set types for a function which is as function argument and can have any arguments and any returns
body: <p>I want to write a debounce function with typescript. My code is shown below:</p>
  <pre class="lang-js prettyprint-override"><code>function debounce(fn: Function, time: number): Function {
    // ...
  }
  </code></pre>
  <p>And then, my <code>eslint</code> tell me don't use <code>Function</code> as a type. Below is original text:</p>
  <p>Don't use <code>Function</code> as a type. The <code>Function</code> type accepts any function-like value.
  It provides no type safety when calling the function, which can be a common source of bugs.
  It also accepts things like class declarations, which will throw at runtime as they will not be called with <code>new</code>.</p>
  <p>If you are expecting the function to accept certain arguments, you should explicitly define the function shape.</p>
  <p>That's the problem, any suggestion?</p>
  <p>==================== Some update ==================================</p>
  <p>If use javascript, my code will be:</p>
  <pre class="lang-js prettyprint-override"><code>function debounce(fn, time) {
    let timer
    return function (...args) {
      clearTimeout(timer)
      timer = setTimeout(() =&gt; fn(...args), time)
    }
  }
  </code></pre>