title: Extending Union Types Alias in TypeScript?
body: <p>I'm trying to limit some string fields to be only of certain values at compile time. The problem is that those values should be extendable.
  Here's a simplified example:</p>
  
  <pre><code>type Foobar = 'FOO' | 'BAR';
  
  interface SomeInterface&lt;T extends Foobar&gt; {
    amember: T;
  
    [key: string]: string; // this really has to stay
  }
  
  // let's test it
  
  const yes = {
      amember: 'FOO'
  } as SomeInterface&lt;'FOO'&gt;; // compiles as expected
  
  //    const no = {
  //        amember: 'BAZ'
  //    } as SomeInterface&lt;'BAZ'&gt;; // Type '"BAZ"' does not satisfy the constraint 'Foobar' as expected
  
  // so far so good
  // Now the problem
  
  abstract class SomeClass&lt;T extends Foobar&gt; {
    private anotherMember: SomeInterface&lt;T&gt;;
  }
  
  type Foobarbaz = Foobar | 'BAZ';
  
  class FinalClass extends SomeClass&lt;Foobarbaz&gt; { //no good anymore
  }
  </code></pre>
  
  <p>The error is </p>
  
  <blockquote>
    <p>Type 'Foobarbaz' does not satisfy the constraint 'Foobar'.   Type
    '"BAZ"' is not assignable to type 'Foobar'.</p>
  </blockquote>
  
  <p>So the question is: how in typescript can I limit a 'type' to be of certain strings only, but have it extendable with other strings?
  Or is this an XY problem and there's an obvious better solution?</p>
  
  <p>Typescript 2.3.4 but i think i can upgrade to 2.4 if there's magic there.</p>