<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8</p>
<p dir="auto"><strong>Code</strong></p>
<p dir="auto">I have following tsconfig.json file in my project root directory (e.g. P:\MyProjectRoot\tsconfig.json):</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;compileOnSave&quot;: true,
    &quot;compilerOptions&quot;: {
        &quot;preserveConstEnums&quot;: true,
        &quot;experimentalDecorators&quot;: true,
        &quot;declaration&quot;: false,
        &quot;emitBOM&quot;: true,
        &quot;sourceMap&quot;: true,
        &quot;outFile&quot;: &quot;Scripts/site/Serene.Web.js&quot;
    }
}"><pre class="notranslate">{
    <span class="pl-ent">"compileOnSave"</span>: <span class="pl-c1">true</span>,
    <span class="pl-ent">"compilerOptions"</span>: {
        <span class="pl-ent">"preserveConstEnums"</span>: <span class="pl-c1">true</span>,
        <span class="pl-ent">"experimentalDecorators"</span>: <span class="pl-c1">true</span>,
        <span class="pl-ent">"declaration"</span>: <span class="pl-c1">false</span>,
        <span class="pl-ent">"emitBOM"</span>: <span class="pl-c1">true</span>,
        <span class="pl-ent">"sourceMap"</span>: <span class="pl-c1">true</span>,
        <span class="pl-ent">"outFile"</span>: <span class="pl-s"><span class="pl-pds">"</span>Scripts/site/Serene.Web.js<span class="pl-pds">"</span></span>
    }
}</pre></div>
<p dir="auto">I have my .ts files under some sub folders of ~/Scripts and ~/Modules directories.</p>
<p dir="auto">I'm running TypeScript compiler with the following command line:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  P:\MyProjectRoot&gt;&quot;c:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc&quot;"><pre class="notranslate"><code class="notranslate">  P:\MyProjectRoot&gt;"c:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc"
</code></pre></div>
<p dir="auto"><strong>Expected behavior:</strong></p>
<p dir="auto">I expect it to generate a output at P:\MyProjectRoot\scripts\site\Serene.Web.js</p>
<p dir="auto"><strong>Actual behavior:</strong></p>
<p dir="auto">tsc just exists without generating a file or giving any error.</p>
<p dir="auto">If i run same command line under P:\MyProjectRoot\scripts:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  P:\MyProjectRoot\scripts&gt;&quot;c:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc&quot;"><pre class="notranslate"><code class="notranslate">  P:\MyProjectRoot\scripts&gt;"c:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc"
</code></pre></div>
<p dir="auto">It generates the expected output.</p>
<p dir="auto">As a side note, tsc is not in path, not sure if it has any effects.</p>
<p dir="auto">Also this root folder has a .csproj file with TypeScript configured. I tried to delete all files except tsconfig.json in root directory, but it had no effect.</p>
<p dir="auto">There is no other tsconfig.json file in subdirectories or parent folders.</p>
<p dir="auto">From the kangax compatibility table (<a href="http://kangax.github.io/compat-table/es6/#block-level_function_declaration" rel="nofollow">related test</a>):</p>
<blockquote>
<p dir="auto"><a href="http://kangax.github.io/compat-table/es6/index.html#block-level-function-note" rel="nofollow">14</a> Note that prior to ES6, it was <a href="http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls" rel="nofollow">recommended</a> that ES5 implementations forbid block-level declarations in strict mode.</p>
</blockquote>
<p dir="auto">In ES6, block-level function declarations have block scoping in strict mode. Currently the following is a compiler error in TypeScript:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;
function f() { // error TS2393: Duplicate function implementation.
  return 1;
}

{
  function f() { // error TS2393: Duplicate function implementation.
    return 2;
  }
  console.log(f() === 2);
}

console.log(f() === 1);"><pre class="notranslate"><span class="pl-s">"use strict"</span><span class="pl-kos">;</span>
<span class="pl-k">function</span> <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-c">// error TS2393: Duplicate function implementation.</span>
  <span class="pl-k">return</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-kos">{</span>
  <span class="pl-k">function</span> <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-c">// error TS2393: Duplicate function implementation.</span>
    <span class="pl-k">return</span> <span class="pl-c1">2</span><span class="pl-kos">;</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-en">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">===</span> <span class="pl-c1">2</span><span class="pl-kos">)</span><span class="pl-kos">;</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-en">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">===</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">We should consider the following changes:</p>
<ol dir="auto">
<li>Allow the above in ES6 when in strict mode, with the function declaration <code class="notranslate">f</code> being block-scoped with respect to name resolution.</li>
<li>For ES5 strict-mode, allow the above with the following emit:</li>
</ol>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;
function f() {
  return 1;
}

{
  function f_1() {
    return 2;
  }
  console.log(f_1() === 2);
}

console.log(f() === 1);"><pre class="notranslate"><span class="pl-s">"use strict"</span><span class="pl-kos">;</span>
<span class="pl-k">function</span> <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-kos">{</span>
  <span class="pl-k">function</span> <span class="pl-en">f_1</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-c1">2</span><span class="pl-kos">;</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-en">f_1</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">===</span> <span class="pl-c1">2</span><span class="pl-kos">)</span><span class="pl-kos">;</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-en">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">===</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>