title: Why does the TypeScript transpiler compile enums into dictionary lookups instead of simple objects?
body: <p>I am curious as to why the TypeScript transpiler compiles enums into dictionary lookups instead of simple objects. Here is an example TypeScript enum:</p>
  
  <pre><code>enum transactionTypesEnum {
      None = 0,
  
      OSI = 4, 
      RSP = 5,
      VSP = 6,
      SDIV = 7,
      CDIV = 8
  }
  </code></pre>
  
  <p>Here is the JS code TypeScript emits:</p>
  
  <pre><code>var TransactionTypes;
  (function (TransactionTypes) {
      TransactionTypes[TransactionTypes["None"] = 0] = "None";
      TransactionTypes[TransactionTypes["OSI"] = 4] = "OSI"; 
      TransactionTypes[TransactionTypes["RSP"] = 5] = "RSP"; 
      TransactionTypes[TransactionTypes["VSP"] = 6] = "VSP"; 
      TransactionTypes[TransactionTypes["SDIV"] = 7] = "SDIV";
      TransactionTypes[TransactionTypes["CDIV"] = 8] = "CDIV";
  })(TransactionTypes || (TransactionTypes = {}));
  </code></pre>
  
  <p>My curiosity is wondering why TypeScript doesn't simply do this:</p>
  
  <pre><code>var TransactionTypes = {
      None: 0,
      OSI: 4,
      RSP: 5,
      VSP: 6,
      SDIV: 7,
      CDIV: 8
  }
  </code></pre>