title: How to get type from the return of a function?
body: <p>I'm trying to make a pseudo pipeline in typscript. The idea is that I would have a function that returns me an object. Then I would pass this object to other functions that can process this object.</p>
  <p>The function signature would be something like this:</p>
  <pre class="lang-js prettyprint-override"><code>type FirstFunc&lt;T&gt; = () =&gt; T;
  type Pipeline&lt;T&gt; = ((obj: T) =&gt; T)[]
  
  const objPipeLine&lt;T&gt; = (firstFunc: FirstFunc&lt;T&gt;, pipeline: Pipeline&lt;T&gt;): T
  </code></pre>
  <p>But I don't want to provide the generic to this function. I want it to know what type of object the first function would return and use it as my T generic. Something like an implicit typing, the functions in the Pipeline should only accept parameters matching the kind of object my first function returns.</p>