title: Typescript - Using generics to extend an interface with a property of union type
body: <p>I have an interface like this</p>
  
  <pre><code>interface Test {
    values: string[] | number[] | Date[]
    // more properties
  }
  </code></pre>
  
  <p>I would like to create another interface that makes the type specific. What I am trying is:</p>
  
  <pre><code>interface TestWithType&lt;T extends string | number | Date&gt; extends Test {
    values: T[];
  }
  </code></pre>
  
  <p>But this fails with an error saying <code>Type 'string' is not assignable to type 'Date'</code>.</p>
  
  <p>What is the correct syntax for this? If property <code>values</code> was not an array, this would work fine</p>
  
  <pre><code>interface Test {
    values: string | number | Date
  }
  
  interface TestWithType&lt;T extends string | number | Date&gt; extends Test {
    values: T;
  }
  </code></pre>