title: Get type of last function from arbitrary amount of closures
body: <p>Consider a function:</p>
  <pre><code>const f = a =&gt; b =&gt; ... x =&gt; { return somevalue }
  </code></pre>
  <p>How do I get the type for just the last function <code>typeof x =&gt; { return somevalue }</code> without knowing the total amount of closures?</p>
  <p>My initial thought is that we need to build a type that uses recursion and conditional type checking until we reach the end. However, I'm not sure if typescript supports recursive types for this kind of problem.</p>