title: How to infer type of function parameters in generic type
body: <p>I am trying to create tuple type that contains two elements, the first being a function and the second the parameters it takes. I have been somewhat successful by creating a generic type <code>CallbackTuple</code>. Ideally I would like to be able to infer the second element of the tuple without explicitly having to pass the type argument <code>typeof a</code>, how would I do this?</p>
  <pre class="lang-js prettyprint-override"><code>function a({ foo, bar }: { foo: string; bar: number }) {
    return { foo, bar };
  }
  
  type CallbackTuple&lt;
    PluginFn extends (...args: any[]) =&gt; any = (...args: any[]) =&gt; any
  &gt; = [PluginFn, ...Parameters&lt;PluginFn&gt;];
  
  const cbTuple1: CallbackTuple&lt;typeof a&gt; = [a, { foo: &quot;&quot;, bar: 1 }]; // Valid
  const cbTuple2: CallbackTuple&lt;typeof a&gt; = [a, { foo: &quot;&quot; }]; // Property 'bar' is missing
  const cbTuple3: CallbackTuple = [a, { foo: &quot;&quot; }]; // I want this to type check properly
  </code></pre>