<h2 dir="auto">Feature Request</h2>
<p dir="auto">In the <a href="https://babeljs.io/docs/en/babel-plugin-transform-typescript" rel="nofollow">docs</a>, it says that:</p>
<blockquote>
<p dir="auto">Does not support <code class="notranslate">const enum</code>s because those require type information to compile.</p>
</blockquote>
<p dir="auto">I don't believe that this is true. Babel should be able to transpile <code class="notranslate">const enum</code>s into objects, which will achieve the same functionality as typescript, through different transpiled output.</p>
<p dir="auto">Given this code:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const enum Direction { Left, Right, Down, Up }
console.log(Direction.Down)"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-k">enum</span> <span class="pl-smi">Direction</span> <span class="pl-kos">{</span> <span class="pl-c1">Left</span><span class="pl-kos">,</span> <span class="pl-c1">Right</span><span class="pl-kos">,</span> <span class="pl-c1">Down</span><span class="pl-kos">,</span> <span class="pl-c1">Up</span> <span class="pl-kos">}</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-smi">Direction</span><span class="pl-kos">.</span><span class="pl-c1">Down</span><span class="pl-kos">)</span></pre></div>
<p dir="auto"><code class="notranslate">tsc</code> would compile this to:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="console.log(2)"><pre class="notranslate"><span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-c1">2</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">I propose that Babel compiles the enum to:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const Direction = {
  Left: 0,
  Right: 1,
  Down: 2,
  Up: 3
}
console.log(Direction.Down)"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-v">Direction</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-c1">Left</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span>
  <span class="pl-c1">Right</span>: <span class="pl-c1">1</span><span class="pl-kos">,</span>
  <span class="pl-c1">Down</span>: <span class="pl-c1">2</span><span class="pl-kos">,</span>
  <span class="pl-c1">Up</span>: <span class="pl-c1">3</span>
<span class="pl-kos">}</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-v">Direction</span><span class="pl-kos">.</span><span class="pl-c1">Down</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">Which functions the same as the <code class="notranslate">tsc</code> output.</p>
<p dir="auto">A minifier like <code class="notranslate">terser</code>/<code class="notranslate">uglify</code> is able to transpile that output <g-emoji class="g-emoji" alias="point_up" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/261d.png">☝️</g-emoji> to the same as the <code class="notranslate">tsc</code> output.</p>
<p dir="auto">I'm currently targeting IE9+ in my project. I have to use <code class="notranslate">spec.protoToAssign</code> to get classes working. The <code class="notranslate">babelHelpers.inherits</code> helper uses <code class="notranslate">__proto__</code>, which requires the helpers to be transformed. So this forces me to either use inline helpers (a lot of duplication) or to use <code class="notranslate">babel.buildExternalHelpers</code>, which requires me to do a transform with a different set of options.</p>
<p dir="auto">In the case of <code class="notranslate">babelHelpers.inherits</code>, and possibly even <code class="notranslate">spec.protoToAssign</code>, would it make sense to use Object.setPrototypeOf instead of <code class="notranslate">__proto__</code> and defer the functionality to a pollyfill?</p>