title: TypeScript - generic being incorrectly inferred as unknown
body: <p>I have the following generic function:</p>
  
  <pre><code>export function useClientRequest&lt;T, R extends (...args: any) =&gt; AxiosPromise&lt;T&gt;&gt;(
    func: R,
    ...args: Parameters&lt;R&gt;
  ): [T | undefined, boolean, AxiosError | undefined] {
    // Irrelevant
  }
  </code></pre>
  
  <p>Summarily, the function's return contains a value of type T which should be inferred as described above.</p>
  
  <p>I then try to use it as follows:</p>
  
  <pre><code>interface Foo {
    // ...
  }
  
  function fooGetter(url: string): AxiosPromise&lt;Foo&gt; {
    return Axios.get&lt;Foo&gt;(url);
  }
  
  const [data] = useClientRequest(fooGetter, 'url.com');
  </code></pre>
  
  <p>However my IDE reports that <code>data</code> is of type <code>unknown</code>, because <code>T</code> is being inferred as <code>unknown</code>.</p>
  
  <p>Am I doing something wrong or is this a TypeScript limitation?</p>
  
  <p>Typescript v3.7.2</p>
  
  <p>I know I can specify the type parameters. I'm wondering why they are being inferred incorrectly and if I can somehow change the implementation to help the inferring mechanism.</p>