title: Object.fromEntries in Typescript
body: <p>I'm trying to declare type <code>ObjectFromEntries</code> which behaves like return type of <code>Object.fromEntries</code> function. So:</p>
  
  <pre><code>type ObjectFromEntries&lt;Entries extends [keyof any, any][]&gt; = { [key in Entries[number][0]]: ___ };
  
  declare var z: ObjectFromEntries&lt;[["a", number], ["b", string], ["c", Date]]&gt;
  z.a // expected: number
  z.b // expected: string
  z.c // expected: Date
  </code></pre>
  
  <p>But I don't know what to place instead of <code>___</code>.</p>
  
  <p>If I try <code>key extends Entries[infer I][0] ? Entries[I][1] : never</code> I get an error</p>
  
  <blockquote>
    <p>Type 'I' cannot be used to index type 'Entries'.(2536)<br>
    Type '0' cannot be used to index type 'Entries[I]'.(2536)</p>
  </blockquote>
  
  <p>If I try <code>Entries[number][1]</code> I get type <code>string | number | Date</code> for every property and that's logical.</p>
  
  <p>How can I sync up <code>key</code> with index to get a proper type?</p>