title: Typescript : Filter on keyof type parameter
body: <p>I'm using typescript 3.8.3 and try to dynamically find the keys of a certain type and use them to produce an other object.</p>
  
  <p>I have a <code>Detail</code> object and want to use it to dynamically generate a <code>Column</code> object only based on the properties of type <code>Desc</code>.
  Here is a simplified code of what i want to do :</p>
  
  <pre><code>// Model
  interface Desc {
      creationDate: Date;
  }
  
  interface Address extends Desc {
      zipCode: number;
      adressName: string;
  }
  
  interface Order extends Desc {
      id: number;
      orderName: string;
  }
  
  interface Detail {
      name: string;
      address: Address[];
      orders: Order[];
  }
  // Table column configuration
  interface Column&lt;T&gt; {
      field: keyof T;
      active: boolean;
  }
  
  type ColumnConfig&lt;T&gt; = { [P in keyof T]: Column&lt;T[P] extends Desc ? P : never&gt;[] };
  
  const config: ColumnConfig&lt;Detail&gt; = {
      address: [
          {
              field: "zipCode",
              active: true 
          }, 
          {
              field: "addressName",
              active: true
          }
      ],
      order: [
          {
              field: "id",
              active:false
          },
          {
              field: "orderName",
              active: false
          }
      ],
      // Detail.name should not be available but it is
  
  }
  </code></pre>
  
  <p>How can i benefit from the help of the compiler to construct my <code>config</code> object and thus be able to detect any errors if my <code>Detail</code> object changes ? </p>
  
  <p>Thanks !</p>