<p dir="auto">Module loaders like <a href="https://github.com/systemjs/systemjs">systemjs</a> expect module paths to point to a valid file path, including the .js extension. Although <a href="http://exploringjs.com/es6/ch_modules.html#_modules-in-javascript" rel="nofollow">exploringjs</a> says the extension might not be needed, the module loader spec's default behaviour has not yet been decided upon. So for code to have the widest possible support it would be good to have an option to tell the compiler to add the extension.</p>
<p dir="auto">Currently, TS can't find modules when you use a file extension in the import name (<code class="notranslate">import {Foo} from './foo.ts';</code>) - <a href="https://github.com/systemjs/systemjs/releases/tag/0.17.0">SystemJS updated</a> and file extensions are now <a href="https://github.com/whatwg/loader/issues/52" data-hovercard-type="issue" data-hovercard-url="/whatwg/loader/issues/52/hovercard"><em>required</em></a> (though the spec issue is still under discussion) on imports (without setting some legacy settings in <code class="notranslate">System.config</code>). So when compiling with <code class="notranslate">--module</code>, you can either have a functioning typechecker (no extensions on your imports) or a functioning runtime (<code class="notranslate">.js</code> on your imports, since your result files have <code class="notranslate">.js</code> extensions). This is complicated further by systemjs's <a href="https://github.com/systemjs/builder">bundler</a>, which looks for dependent files <em>before</em> TS transpiles them, so you have to use <code class="notranslate">.ts</code> extensions on your imports so the <em>bundler</em> can resolve the paths to real ones.</p>
<p dir="auto">This extension madness is all incredibly awkward to work with, and I'm not sure if this needs module resolution logic updating on our part, arguing for old behavior on the loader spec, or talking to <code class="notranslate">systemjs</code> and having them change how they're finding modules ignoring the spec.</p>