title: Trouble understanding type indexing
body: <p>I'm having trouble understanding the following type definition:</p>
  <pre><code>type MergeHandlersReturnType&lt;H extends Record&lt;string, any&gt;&gt; = {
    [K in keyof H]: ReturnType&lt;H[K]&gt;
  }[keyof H]
  </code></pre>
  <p>Decomposing the above definition using similar types I'm not getting why the following is giving me compiler errors</p>
  <pre><code>interface R1 extends Record&lt;string, any&gt; {
    &quot;key1&quot;: () =&gt; 0|1
  }
  
  const v1: R1 = {
    &quot;key1&quot;: () =&gt; 1,
    &quot;key2&quot;: () =&gt; 2,
    &quot;key3&quot;: () =&gt; 3
  }
  
  type Merged&lt;R1&gt; = {
    [K in keyof R1]: ReturnType&lt;R1[K]&gt;
                                ^^^^^
      }[keyof R1]
  
  
  Type 'R1[K]' does not satisfy the constraint '(...args: any) =&gt; any'.
    Type 'R1[keyof R1]' is not assignable to type '(...args: any) =&gt; any'.
      Type 'R1[string] | R1[number] | R1[symbol]' is not assignable to type '(...args: any) =&gt; any'.
        Type 'R1[string]' is not assignable to type '(...args: any) =&gt; any'.ts(2344)
  </code></pre>
  <p>I was expecting the <code>Merged</code> type to be the unions of the return types of the keys of <code>R1</code> but the indexing is failing.</p>