title: Union type of two functions in Typescript
body: <p>I have a situation where I have a type which is a union of two functions which have a literal value as the type of one of their arguments. Boiled down to a minimal example, it is essentially this:</p>
  
  <pre><code>type FetchMini = (id: number, representation: 'mini') =&gt; MiniUser;
  type FetchFull = (id: number, representation: 'full') =&gt; FullUser;
  
  function f(fetchUser: FetchMini | FetchFull) {
    fetchUser(2, 'mini');
    fetchUser(2, 'full');
  }
  </code></pre>
  
  <p>Both of these calls fail the compiler with the message:</p>
  
  <blockquote>
    <p>Cannot invoke an expression whose type lacks a call signature. Type 'FetchMini | FetchFull' has no compatible call signatures.`</p>
  </blockquote>
  
  <p>I <em>think</em> I understand the reason why this happens, (...I think) but what could I do about it?</p>
  
  <p>Here's a similar question, however it got no answers: <a href="https://stackoverflow.com/questions/41668764/union-of-functions-is-not-callable-even-with-parameters-that-meet-each-function">Union of functions is not callable even with parameters that meet each function&#39;s constraints</a></p>