<p dir="auto">The following fails to typecheck, complaining that <code class="notranslate">type 'number' is not assignable to type '() =&gt; void'</code>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function nop(): void { return void 0; }
function foo(xs: (number | (()=&gt;void))[]): (() =&gt; void) {
    return xs.reduce(((acc, x) =&gt; nop), nop);
}"><pre class="notranslate"><code class="notranslate">function nop(): void { return void 0; }
function foo(xs: (number | (()=&gt;void))[]): (() =&gt; void) {
    return xs.reduce(((acc, x) =&gt; nop), nop);
}
</code></pre></div>
<p dir="auto">But the code never actually looks at the contents, so it should work (and it does, if I change the argument type to something other than a function).</p>
<p dir="auto">Referencing <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="91174972" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/3645" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/3645/hovercard" href="https://github.com/microsoft/TypeScript/issues/3645">#3645</a>:<br>
<br><br>
I agree with <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Eisenspalter/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Eisenspalter">@Eisenspalter</a>: Multiple tsconfig files are indispensable for large enterprise apps.</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mhegazy/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mhegazy">@mhegazy</a> : As you wrote you don't want to support <code class="notranslate">tsconfig.json</code> file inheritance, I'd like to propose the following:<br>
<br></p>
<h4 dir="auto">My proposal</h4>
<p dir="auto">TSC should come with a <strong>new command line parameter</strong>, enabling the following behaviour:</p>
<ol dir="auto">
<li>The TSC process will browse the project directory for <code class="notranslate">tsconfig.json</code> files.</li>
<li>If no <code class="notranslate">tsconfig.json</code> files will be found, TSC proceeds with its normal behaviour: Compiling all .ts files found in the projects sub directories, using the default configuration.</li>
<li>If, instead, any <code class="notranslate">tsconfig.json</code> file will be found, the TSC process refrains from compiling. Instead it spawns a new TSC child process for the <code class="notranslate">tsconfig.json</code> file and continues browsing the project's sub directories for <code class="notranslate">tsconfig.json</code> files. It does this for each <code class="notranslate">tsconfig.json</code> file it reaches.</li>
<li>With each new TSC process it creates it sets the <code class="notranslate">-project</code> parameter and current working directory of that child process to the <code class="notranslate">tsconfig.json</code> file's.</li>
<li>Any TSC process will stop evaluating a sub directory (= any directory different from <code class="notranslate">-project</code>) if it finds a <code class="notranslate">tsconfig.json</code> file in there.</li>
</ol>
<p dir="auto">The new command line parameter (e.g. <code class="notranslate">-browseConfig</code>) should require a directory information, similar to the <code class="notranslate">-project</code> command line parameter. This will allow the user to provide a dedicated sub directory as root for scanning.</p>
<br>
#### Example
<p dir="auto">The following example depicts the original TSC process to start at <code class="notranslate">-browseConfig "."</code> ("Project root"):</p>
<p dir="auto"><code class="notranslate">TSC -browseConfig "."</code></p>
<p dir="auto">Browsing the project directory tree it finds three <code class="notranslate">tsconfig.json</code> files. For each of the <code class="notranslate">tsconfig.json</code> files it spawns a new TSC process:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CD &quot;scripts&quot;
TSC"><pre class="notranslate"><code class="notranslate">CD "scripts"
TSC
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CD &quot;scripts/sub directory n&quot;
TSC"><pre class="notranslate"><code class="notranslate">CD "scripts/sub directory n"
TSC
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CD &quot;scripts/sub directory n/sub directory n&quot;
TSC"><pre class="notranslate"><code class="notranslate">CD "scripts/sub directory n/sub directory n"
TSC
</code></pre></div>
<p dir="auto">So there will be four <code class="notranslate">TSC</code> processes running in parallel (good for multi-core systems <g-emoji class="g-emoji" alias="wink" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f609.png">😉</g-emoji>), each evaluating its sub tree of the project. The first process won't perform any transpilation. It only browses the directory tree.</p>
<p dir="auto">The following images depict the main TSC process and the three sub processes, highlighting the files they transpile:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/9283914/11812575/086daa4a-a33d-11e5-810d-d10f613c6bc8.png"><img src="https://cloud.githubusercontent.com/assets/9283914/11812575/086daa4a-a33d-11e5-810d-d10f613c6bc8.png" alt="tsconfig 3" style="max-width: 100%;"></a><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/9283914/11812659/72d2f37c-a33d-11e5-8e2a-cc0c0f138dfb.png"><img src="https://cloud.githubusercontent.com/assets/9283914/11812659/72d2f37c-a33d-11e5-8e2a-cc0c0f138dfb.png" alt="tsconfig 2a" style="max-width: 100%;"></a><br>
<br><br>
To speed up browsing for <code class="notranslate">tsconfig.json</code> files, the first/main/original TSC process could/should better be started using: <code class="notranslate">TSC -browseConfig "./scripts/"</code></p>