title: TypeScript Union Types number or specific string
body: <p>I am experimenting with typeScript Union Types.
  I have a class with a numeric property, but I want it to have three special cases: Infinity, None and Auto</p>
  
  <p>Infinity and None can be represented with <code>Number.POSITIVE_INFINITY</code> and <code>NULL</code> respectively, but I don't know what to do about the auto-value.</p>
  
  <p>This value originally comes in an XML-document represented as a string. For example <code>&lt;element myValue="123"/&gt;</code> <code>&lt;element myValue="-4096"/&gt;</code> <code>&lt;element myValue="infinity"/&gt;</code> <code>&lt;element myValue="auto"/&gt;</code> or <code>&lt;element/&gt;</code></p>
  
  <p>How can I create a union type that can be used as a number but still have the auto value available. I thought about a union type with number and Enum but I am not sure how to make the best out of it.</p>
  
  <p>Any tips?</p>
  
  <pre><code>class MyClass {
      name: string;
      duration: number; // Want to support None/Null, Infinity and Auto
  }
  </code></pre>