title: Typescript: can't define return type of a function from multiple conditional typings
body: <p>I'm tring to build a return type of a function from multiple conditional typings.
  What i'am trying to get as the returns of the function <code>buildKindsFor</code> is an object containing all kinds possible keys variation attached to a function.</p>
  
  <p>Code sample will be better, in the first one everything is ok:</p>
  
  <pre><code>type KindNames =
    | 'one' | 'two' | 'three'
  
  type KindShort&lt;T extends  KindNames&gt; =
    T extends 'one' ? 'o' : T extends 'two' ? 'tw' : 'th'
  
  type KindPluralized&lt;T extends  KindNames&gt; =
    T extends 'one' ? 'ones' : T extends 'two' ? 'twos' : 'threes'
  
  const buildKindsFor = &lt;
    K extends KindNames,
    S extends KindShort&lt;K&gt;,
    P extends KindPluralized&lt;K&gt;,
  &gt;(
    kind: K,
    fn: (kind: KindNames, obj: any) =&gt; any,
  ): {
    [A in K]: () =&gt; any
  } =&gt; {
    throw new Error ('Yet to implement !')
  }
  </code></pre>
  
  <p>But when I try to add an entry in the returns object, let's say the short version, everything breaks such as (the error is all over, in comments are some of the messages when i hover over in the IDE):</p>
  
  <pre><code>const buildKindsFor = &lt;
    K extends KindNames,
    S extends KindShort&lt;K&gt;, // Cannot find name K
    P extends KindPluralized&lt;K&gt;, // 'KindPluralized' only refers to a type, but is being used as a value here
  &gt;(
    kind: K,
    fn: (kind: KindNames, obj: any) =&gt; any,
  ): {
    [A in K]: () =&gt; any // ';' expected, ... and so on
    [B in S]: () =&gt; boolean
  } =&gt; {
    throw new Error ('Yet to implement !')
  }
  </code></pre>
  
  <p>The expected returns type for a call to let's say <code>buildKindsFor ('one', dummyFn)</code> should be something like:</p>
  
  <pre><code>{
    one: () =&gt; any
    o: () =&gt; boolean
    ones: () =&gt; string
  }
  </code></pre>
  
  <p>Thanks in advance for anyone who could point me what i am missing.
  Seb</p>