<p dir="auto">tsc --allowJs moment-with-locales.min.js</p>
<p dir="auto">on min/moment-with-locales.min.js<br>
from <a href="https://github.com/moment/moment/archive/2.11.1.zip">https://github.com/moment/moment/archive/2.11.1.zip</a></p>
<p dir="auto">gives<br>
node_modules/typescript/lib/tsc.js:32405<br>
if (moduleName.indexOf("!") != -1) {<br>
^<br>
TypeError: Cannot read property 'indexOf' of undefined<br>
at classicNameResolver (node_modules/typescript/lib/tsc.js:32405:23)<br>
at resolveModuleName (node_modules/typescript/lib/tsc.js:32308:28)<br>
at resolveModuleNamesWorker (node_modules/typescript/lib/tsc.js:32573:40)<br>
at processImportedModules (node_modules/typescript/lib/tsc.js:33156:35)<br>
at findSourceFile (node_modules/typescript/lib/tsc.js:33132:17)<br>
at processSourceFile node_modules/typescript/lib/tsc.js:33059:27)<br>
at processRootFile (node_modules/typescript/lib/tsc.js:32982:13)<br>
at node_modules/typescript/lib/tsc.js:32594:60<br>
at Object.forEach (node_modules/typescript/lib/tsc.js:98:30)<br>
at Object.createProgram (node_modules/typescript/lib/tsc.js:32594:16)</p>
<p dir="auto">If you include the file <a href="http://momentjs.com/downloads/moment.js" rel="nofollow">http://momentjs.com/downloads/moment.js</a> in a <code class="notranslate">tsc --allowJs</code> compilation, a TypeError is thrown:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: Cannot call method 'indexOf' of undefined
    at classicNameResolver (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32405:24)
    at resolveModuleName (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32308:28)
    at resolveModuleNamesWorker (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32573:40)
    at processImportedModules (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:33156:35)
    at findSourceFile (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:33132:17)
    at processSourceFile (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:33059:27)
    at processRootFile (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32982:13)
    at /home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32594:60
    at Object.forEach (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:98:30)
    at Object.createProgram (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32594:16)"><pre class="notranslate"><code class="notranslate">TypeError: Cannot call method 'indexOf' of undefined
    at classicNameResolver (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32405:24)
    at resolveModuleName (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32308:28)
    at resolveModuleNamesWorker (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32573:40)
    at processImportedModules (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:33156:35)
    at findSourceFile (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:33132:17)
    at processSourceFile (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:33059:27)
    at processRootFile (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32982:13)
    at /home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32594:60
    at Object.forEach (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:98:30)
    at Object.createProgram (/home/jeffrey/TypeScript-1.8.0-beta/lib/tsc.js:32594:16)
</code></pre></div>
<p dir="auto">This is caused by the following JS source line:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="require('./locale/' + name);"><pre class="notranslate"><span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'./locale/'</span> <span class="pl-c1">+</span> <span class="pl-s1">name</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">The function <code class="notranslate">isRequireCall</code> in utilities.ts returns true on this expression, but there are two places that assume that if <code class="notranslate">isRequireCall</code> returns true, then the argument must be a string literal.</p>