title: TypeScript interface matching a function and its arguments
body: <p>I have a few functions with different argument signatures:</p>
  <pre><code>function foo(a: number) {...}
  function bar(a: string) {...}
  ...
  </code></pre>
  <p>I need to create a TypeScript interface (or type) to capture the following:</p>
  <pre><code>interface MyInterface {
     method: typeof foo | typeof bar;
     args: Parameters&lt;foo | bar&gt;;
  }
  </code></pre>
  <p>Such that if the <code>method</code> supplied is foo, TypeScript will complain if <code>args</code> is <code>[string]</code>, as it should expect <code>[number]</code> for foo. Likewise, if <code>method</code> is bar, <code>args</code> should be of type <code>[string]</code>.</p>
  <p>So <code>method</code> could be any one of the functions I supply to the interface, and <code>args</code> should be the corresponding arguments for that function.</p>