title: How to add types to `...args` in typescript
body: <p>I have a function like this</p>
  
  <pre><code>function foobar(...args): any {
      ....
  }
  </code></pre>
  
  <p>The function signature is rather general, but it only accepts strings and an last an object of type X (all being optional)</p>
  
  <pre><code>foobar();
  foobar('a');
  foobar('a', 'b', 'c');
  foobar('a', { ... });
  foonbar('a', 'b', { ... }); 
  </code></pre>
  
  <p>Is there some way that types can be added, for example</p>
  
  <pre><code>function foobar(...args: [...string, X]) {  // this doesn't work!
  
  }
  </code></pre>
  
  <p>Any suggestions ?</p>