Typescript ReturnType of generic function : <p>The new <code>ReturnType</code> in <a href="https://github.com/Microsoft/TypeScript/wiki/What&#39;s-new-in-TypeScript#type-inference-in-conditional-types" rel="noreferrer">TypeScript 2.8</a> is a really useful feature that lets you extract the return type of a particular function.</p>

<pre><code>function foo(e: number): number {
    return e;
}

type fooReturn = ReturnType&lt;typeof foo&gt;; // number
</code></pre>

<p>However, I'm having trouble using it in the context of generic functions.</p>

<pre><code>function foo&lt;T&gt;(e: T): T {
    return e;
}

type fooReturn = ReturnType&lt;typeof foo&gt;; // type fooReturn = {}

type fooReturn = ReturnType&lt;typeof foo&lt;number&gt;&gt;; // syntax error

type fooReturn = ReturnType&lt;(typeof foo)&lt;number&gt;&gt;; // syntax error
</code></pre>

<p>Is there a way extract the return type that a generic function would have given  particular type parameters?</p>
