title: Is it possible to combine members of multiple types in a TypeScript annotation?
body: <p>It seems that what I am trying to do is not possible, but I really hope it is.</p>
  
  <p>Essentially, I have two interfaces, and I want to annotate a single function parameter as the combination of both of them.</p>
  
  <pre><code>interface ClientRequest {
      userId:     number
      sessionKey: string
  }
  
  interface Coords {
      lat:  number
      long: number
  }
  </code></pre>
  
  <p>And then, in the function, I want to do something like this:</p>
  
  <pre><code>function(data: ClientRequest&amp;Coords) { ... }
  </code></pre>
  
  <p>So that my 'data' object could contain all of the members from both types.</p>
  
  <p>I saw something referenced in a <a href="https://github.com/Microsoft/TypeScript/issues/805" rel="noreferrer">spec preview</a>, under "Combining Types' Members", but it seems like this hasn't made it in yet.</p>
  
  <p>If it isn't possible, my solution might look like this:</p>
  
  <pre><code>interface ClientRequest&lt;T&gt; {
      userId:     number
      sessionKey: string
      data?:       T
  }
  
  function(data: ClientRequest&lt;Coords&gt;) { ... }
  </code></pre>
  
  <p>Which would work in this case, although it's not as dynamic as I would like. I would really like to be able to combine multiple (2+) types in the annotation itself:</p>
  
  <pre><code>function(data: TypeA&amp;TypeB&amp;TypeC) { ... }
  </code></pre>
  
  <p>I would guess that the conventional solution is to define a type that extends those types, although that seems less flexible. If I want to add a type, I would have to either</p>
  
  <ul>
  <li>(a) go back to the declaration and rewrite it, or</li>
  <li>(b) create an entirely new interface. Not sure I agree with the extra overhead.</li>
  </ul>
  
  <p>Any TypeScript experts care to point me in the right direction?</p>