title: How to link keyof types within an interface
body: <p>Not sure if this is possible, but it's related to <code>keyof</code> which I'm having a hard time wrapping my mind around...</p>
  
  <p>I currently have this interface:</p>
  
  <pre><code>interface Column&lt;T&gt; {
    header: string;
    field: keyof T;
    format?: (value: any) =&gt; string;
  }
  </code></pre>
  
  <p>First usage for it is to create something that renders a table, given a list of objects and columns.</p>
  
  <pre><code>const rows = [{name: 'Alice', age: 18}, {name: 'Bob', age: 12}];
  
  type Row = typeof rows[0];
  
  const columns: Column&lt;Row&gt;[] = [
    {
      header: 'Name',
      field: 'name',
      format: value =&gt; value.toUpperCase(),
    },
    {
      header: 'Age',
      field: 'age',
      format: value =&gt; value.toLocaleString(),
    },
  ];
  
  const renderTable = &lt;T&gt;(rows: T[], columns: Columns&lt;T&gt;[]) { ... }
  renderTable(rows, columns);
  </code></pre>
  
  <p>Is there a way to get rid of the <code>any</code> type here in the <code>format</code> function? To somehow "link" the <code>keyof T</code> of <code>field</code> with the <code>value</code> of <code>format</code>? I.e. for the first column <code>value</code> should be <code>string</code>, and for the second it should be <code>number</code>?</p>
  
  <hr>
  
  <p>(I know it would be very easy to just print these out manually, but there's also going to be added some auto-magic stuff to this table which will make use of <code>field</code> and <code>format</code>)</p>