<p dir="auto">tsc -v 1.7.5<br>
When compiling for es6 target, with let, const, etc., and using commonjs module, browser (Chrome) complains about let and co. used outside of "strict mode" zone. Adding "use strict" at the beginning of commonjs module should fix this.</p>
<p dir="auto">Note:</p>
<ul dir="auto">
<li>spec for es6, 10.2.1 Strict Mode Code says that "Module code is always strict mode code". This assumes that es6 modules are used, while commonjs' require()'s look differently.</li>
<li>it does not seem to be a problem with node, as it probably relaxes this rule.</li>
<li>Babel's transform-es2015-modules-commonjs inserts "use strict" at the start of the file, satisfying browser's desire to stick to the standard's rule, and it all just works. Unfortunately, this requires a babel step in the build :(</li>
</ul>
<p dir="auto">ES6 modules default to running the code in the module in the strict mode. When transpiling this input into ES5 the strict mode should be preserved.</p>
<p dir="auto">As of Typescript 1.5 beta this is not the case:</p>
<p dir="auto">input:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export class Foo{}"><pre class="notranslate"><code class="notranslate">export class Foo{}
</code></pre></div>
<p dir="auto">transpile with: <code class="notranslate">tsc --module commonjs test.ts</code></p>
<p dir="auto">actual output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var Foo = (function () {
    function Foo() {
    }
    return Foo;
})();
exports.Foo = Foo;"><pre class="notranslate"><code class="notranslate">var Foo = (function () {
    function Foo() {
    }
    return Foo;
})();
exports.Foo = Foo;
</code></pre></div>
<p dir="auto">expected output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="'use strict';

var Foo = (function () {
    function Foo() {
    }
    return Foo;
})();
exports.Foo = Foo;"><pre class="notranslate"><code class="notranslate">'use strict';

var Foo = (function () {
    function Foo() {
    }
    return Foo;
})();
exports.Foo = Foo;
</code></pre></div>
<p dir="auto">The same issue affects output for amd and system module formats.</p>