title: How to type a generic function, which is based on the extended generic type of the first parameters type?
body: <p>I've the following definitions:</p>
  
  <pre><code>class RESTClient&lt;E extends { id: number }&gt; extends Client {}
  class ParticipantClient extends RESTClient&lt;Participant&gt; {}
  const createRESTRequestAction = &lt;E extends { id: number }&gt;(client: RESTClient&lt;E&gt;, value?: E) =&gt; {};
  </code></pre>
  
  <p>Unfortunately the <code>createRESTRequestAction</code> is not typing itself as I want. When I use the following call ..</p>
  
  <pre><code>createRESTRequestAction(ParticipantClient, someRecord);
  </code></pre>
  
  <p>.. TypeScript expects <code>someRecord</code> to be of type <code>{ id: number }</code>. I would like that it expect <code>E</code> to be of type <code>Participant</code> in this case. How can this be achieved?</p>
  
  <p>Is it possible to infer the generic type of the extended RESTClient?</p>
  
  <p>Thank you in advance!</p>