title: How do the different enum variants work in TypeScript?
body: <p>TypeScript has a bunch of different ways to define an enum:</p>
  
  <pre><code>enum Alpha { X, Y, Z }
  const enum Beta { X, Y, Z }
  declare enum Gamma { X, Y, Z }
  declare const enum Delta { X, Y, Z }
  </code></pre>
  
  <p>If I try to use a value from <code>Gamma</code> at runtime, I get an error because <code>Gamma</code> is not defined, but that's not the case for <code>Delta</code> or <code>Alpha</code>? What does <code>const</code> or <code>declare</code> mean on the declarations here?</p>
  
  <p>There's also a <code>preserveConstEnums</code> compiler flag -- how does this interact with these?</p>