title: Typescript - How to create a type with the same properties as an interface, but with different property types
body: <p>I'm making a query builder. I have data models that look like this:</p>
  <pre><code>export interface SalesOrder {
    id: number
    customerName: string;
    date: Date;
  }
  </code></pre>
  <p>In my query builder, I want to have the <code>columns</code> look something like this:</p>
  <pre><code>{
    id: 'salesOrder.id',
    customerName: 'customer.name',
    date: 'salesOrder.date',
  }
  </code></pre>
  <p>I'm trying to figure out how I can type the <code>Columns</code> object generically so that it will have all the keys from the model, but all of the types will be a string. So then I would be able to declare it like <code>const columns: Columns&lt;SalesOrder&gt;</code> and it would understand that the object must have all the same keys as in the <code>SalesOrder</code> model, but with all the values being <code>string</code>.</p>
  <p>I tried this:</p>
  <pre><code>export interface Columns&lt;T&gt; {
    [alias: keyof T]: string;
  }
  </code></pre>
  <p>But it complains about the <code>keyof T</code> part, saying &quot;An index signature parameter type must be either 'string' or 'number'.&quot;</p>