title: restriction on combination of two generics
body: <p>Is there a way in TypeScript to express "You can pass in any two objects, as long as their combination satisfies type X"?</p>
  
  <p>So, if I have the following function:</p>
  
  <pre><code>function myFunction(options: {x: number, y: string}){
  }
  
  </code></pre>
  
  <p>And then, I have a function, that wants to call this function using an combination of two objects:</p>
  
  <pre><code>function callMyFunction&lt;A,B&gt;(a:A,b:B){
      myFunction({...a,...b})
  } 
  </code></pre>
  
  <p>And then it would compile if I did one of the following:</p>
  
  <pre><code>callMyFunction({},{x:1,y:"hello"})
  callMyFunction({x:1},{y:"hello"})
  callMyFunction({x:1,y:"hello"},{})
  </code></pre>
  
  <p>But would not compile if I did for example:</p>
  
  <pre><code>callMyFunction({x:1},{}) //y missing
  callMyFunction({},{y:"hello"}) //x missing
  callMyFunction({},{}) //x and y missing
  </code></pre>
  
  <p>I know that it's possible to restrict a generic type using <code>extends</code>. But is there a way to restrict the combination of two generic types? I imagine something like this:</p>
  
  <pre><code>function callMyFunction&lt;A,B, A&amp;B extends {x:number,y:string}&gt;(a:A,b:B){
      myFunction({...a,...b})
  }
  </code></pre>