title: Typescript has unions, so are enums redundant?
body: <p>Ever since TypeScript introduced unions types, I wonder if there is any reason to declare an enum type. Consider the following enum type declaration:</p>
  <pre><code>enum X { A, B, C }
  var x: X = X.A;
  </code></pre>
  <p>and a similar union type declaration:</p>
  <pre><code>type X: &quot;A&quot; | &quot;B&quot; | &quot;C&quot;
  var x: X = &quot;A&quot;;
  </code></pre>
  <p>If they basically serve the same purpose, and unions are more powerful and expressive, then why are enums necessary?</p>