title: TypeScript: Something similar to ReturnType<...> needed but for the type of the first function argument
body: <p>Is it possible in TypeScript to declare something like ReturnType&lt;...> that does not retrieve the type of the return value but the type of the first argument instead?</p>
  
  <pre><code>type SingleArgFunction&lt;A, R&gt; = (arg: A) =&gt; R
  
  // wrong =&gt; how to implement the following line correctly?
  type FirstArgType&lt;T extends SingleArgFunction&lt;infer A, any&gt;&gt; = A 
  
  const numberToString: SingleArgFunction&lt;number, string&gt; =
      (x: number) =&gt; String(x)
  
  type R = ReturnType&lt;typeof numberToString&gt; // R =&gt; string
  
  type F = FirstArgType&lt;typeof numberToString&gt; // F =&gt; number
  </code></pre>