title: TypeScript, generic type with conditional properties
body: <p>I have an object like this:</p>
  
  <pre><code>filters: Filters = {
    type: {
      name: 'type',
      type: FilterType.checkbox,
      availableValues: [
        { label: 'test 1', value: 1},
        { label: 'test 2', value: 2}
      ]
    },
    search: {
      name: 'search',
      type: FilterType.text,
    }
  }
  </code></pre>
  
  <p>This represent some filters.
  I have 2 filters type and a filter could have some extra properties that are required to work.
  I would like to type it properly.
  The typing depend on the <code>type</code> property.</p>
  
  <p>Some ideas? How can I do it?</p>