<p dir="auto">I'm working on a library using TypeScript called <a href="https://github.com/jiaweihli/monapt">monapt</a>.  I have a grunt task to compile multiple files and concatenate them together.  However, the output definition has some potential downsides. (I can't remember exactly what they are at the moment, but hopefully someone else can shed some light on this)</p>
<p dir="auto">Here is a common manual fix I need to do every time before release: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/jklmli/monapt/commit/0da8b09c64f9870a815c389eac1a0dd38e4f65fe/hovercard" href="https://github.com/jklmli/monapt/commit/0da8b09c64f9870a815c389eac1a0dd38e4f65fe">jklmli/monapt@<tt>0da8b09</tt></a></p>
<p dir="auto">Tried using allowJs with a minified version of google analytics and ran into some duplicate identifier errors. Cut down testcase:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function bar(a) {                                                                
  if (a)                                                                         
    this.x = 1;                                                                  
  else                                                                           
    this.x = 1;                                                                  

  // This also fails and is closer to the actual minified GA version.                                                      
  // a ? (this.x = 1) : (this.x = 1);                                            
} "><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">bar</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>                                                                
  <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">)</span>                                                                         
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">x</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>                                                                  
  <span class="pl-k">else</span>                                                                           
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">x</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>                                                                  

  <span class="pl-c">// This also fails and is closer to the actual minified GA version.                                                      </span>
  <span class="pl-c">// a ? (this.x = 1) : (this.x = 1);                                            </span>
<span class="pl-kos">}</span> </pre></div>
<div class="highlight highlight-source-batchfile notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="tsc --allowJs pretty.js --out foo.js
pretty.js(3,5): error TS2300: Duplicate identifier 'x'.
pretty.js(5,5): error TS2300: Duplicate identifier 'x'."><pre class="notranslate">tsc --allowJs pretty.js --out foo.js
pretty.js(3,5): error TS2300: Duplicate identifier 'x'.
pretty.js(5,5): error TS2300: Duplicate identifier 'x'.</pre></div>