title: Inferred type in generic with multiple type parameters
body: <p>I am trying to setup a generic where the parameter is the key of another object. I can accomplish this using <code>extends keyof</code> when both types are parameters are to the function. </p>
  
  <p>However when the type providing the list of keys is not an argument, just a generic type, typescript requires both generic types to be set.</p>
  
  <p>Consider the following code:</p>
  
  <pre><code>interface Bar {
    z: string;
    t: number;
  }
  
  declare function foo1&lt;T extends keyof Bar&gt;(x: T)
  let t1 = foo1('z');
  
  declare function foo2&lt;K, T extends keyof K&gt;(x: T)
  let t2 = foo2&lt;Bar&gt;('t');
  
  declare function foo3&lt;T&gt;(x: T)
  let t3 = foo3&lt;keyof Bar&gt;('t');
  </code></pre>
  
  <p><a href="https://www.typescriptlang.org/play/index.html#src=interface%20Bar%20%7B%0A%20%20z%3A%20string%3B%0A%20%20t%3A%20number%3B%0A%7D%0A%0A%0Adeclare%20function%20foo1%3CT%20extends%20keyof%20Bar%3E(x%3A%20T)%0Alet%20t1%20%3D%20foo1(&#39;z&#39;)%3B%0A%0Adeclare%20function%20foo2%3CK%2C%20T%20extends%20keyof%20K%3E(x%3A%20T)%0Alet%20t2%20%3D%20foo2%3CBar%3E(&#39;t&#39;)%3B%0A%0Adeclare%20function%20foo3%3CT%3E(x%3A%20T)%0Alet%20t3%20%3D%20foo3%3Ckeyof%20Bar%3E(&#39;t&#39;)%3B%0A" rel="nofollow noreferrer">Playground link</a></p>
  
  <p>Function <code>foo2</code> fails since the second type <code>T</code> is not specified. However I feel like TS should be able to infer the correct typings without an explicit second type.</p>
  
  <p><code>foo3</code> is my workaround, but isn't as nice to work with, is it possible to have typescript perform this inference, or will this be a feature request / bug report to the TS team?</p>