<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8.10</p>
<p dir="auto"><strong>Code</strong></p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;compilerOptions&quot;: {
        &quot;module&quot;: &quot;commonjs&quot;,
        &quot;target&quot;: &quot;ES6&quot;,
        &quot;noLib&quot;: true,
        &quot;outDir&quot;: &quot;out&quot;
    },
    &quot;exclude&quot;: [
        &quot;node_modules&quot;
    ]
}"><pre class="notranslate">{
    <span class="pl-ent">"compilerOptions"</span>: {
        <span class="pl-ent">"module"</span>: <span class="pl-s"><span class="pl-pds">"</span>commonjs<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"target"</span>: <span class="pl-s"><span class="pl-pds">"</span>ES6<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"noLib"</span>: <span class="pl-c1">true</span>,
        <span class="pl-ent">"outDir"</span>: <span class="pl-s"><span class="pl-pds">"</span>out<span class="pl-pds">"</span></span>
    },
    <span class="pl-ent">"exclude"</span>: [
        <span class="pl-s"><span class="pl-pds">"</span>node_modules<span class="pl-pds">"</span></span>
    ]
}</pre></div>
<p dir="auto">Have a file <code class="notranslate">extension.js</code> and run once <code class="notranslate">tsc -p jsconfig.json</code> which gives you a file <code class="notranslate">out/extension.js</code>. Start tsc in watch mode, make a change to <code class="notranslate">extension.js</code></p>
<p dir="auto"><strong>Expected behavior:</strong></p>
<p dir="auto">The compiler should auto-magically exclude the <code class="notranslate">outDir</code>.</p>
<p dir="auto"><strong>Actual behavior:</strong></p>
<p dir="auto">It recurses forever which make the terminal print funny patterns<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1794099/14737223/498e6890-087b-11e6-8272-43ed61e3bd12.png"><img src="https://cloud.githubusercontent.com/assets/1794099/14737223/498e6890-087b-11e6-8272-43ed61e3bd12.png" alt="screen shot 2016-04-22 at 11 13 40" style="max-width: 100%;"></a></p>
<p dir="auto">I think this is useful syntax :)</p>
<p dir="auto">sample.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="interface IFoo {
  foo: string; // not optional
}

class Bar implements IFoo? {
  // Bar does not have a foo property.
}

new Bar().foo;"><pre class="notranslate"><code class="notranslate">interface IFoo {
  foo: string; // not optional
}

class Bar implements IFoo? {
  // Bar does not have a foo property.
}

new Bar().foo;
</code></pre></div>
<p dir="auto">How useful.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class Foo implements Lib.IListener? {
  constructor() { Lib.injectInto(this); }
}

module Lib {
  export interface IListener {
    on(data: any): void;
  }

  export function injectInto(target: any) {
    target.on = () =&gt; { /* do something... */ }; 
  }

  export function listen(receiver: IListener) {
    receiver.on(&quot;foobar&quot;);
  }
}

var obj = new Foo();
Lib.listen(obj);

Lib.listen({
  on: ()=&gt; {} // on method required
});"><pre class="notranslate"><code class="notranslate">class Foo implements Lib.IListener? {
  constructor() { Lib.injectInto(this); }
}

module Lib {
  export interface IListener {
    on(data: any): void;
  }

  export function injectInto(target: any) {
    target.on = () =&gt; { /* do something... */ }; 
  }

  export function listen(receiver: IListener) {
    receiver.on("foobar");
  }
}

var obj = new Foo();
Lib.listen(obj);

Lib.listen({
  on: ()=&gt; {} // on method required
});
</code></pre></div>
<p dir="auto">In real world.</p>
<p dir="auto">case 1.<br>
<a href="https://github.com/borisyankov/DefinitelyTyped/blob/705102df2b652bdbadad23561675116a26e48760/space-pen/space-pen.d.ts#L52">https://github.com/borisyankov/DefinitelyTyped/blob/705102df2b652bdbadad23561675116a26e48760/space-pen/space-pen.d.ts#L52</a></p>
<p dir="auto">case 2.<br>
// Emissary#emitter<br>
<a href="https://github.com/atom/emissary#emitter">https://github.com/atom/emissary#emitter</a><br>
// .d.ts<br>
<a href="https://github.com/borisyankov/DefinitelyTyped/blob/b4aba562ef4192bc3f2e770ab2018f89e047836b/emissary/emissary.d.ts#L13">https://github.com/borisyankov/DefinitelyTyped/blob/b4aba562ef4192bc3f2e770ab2018f89e047836b/emissary/emissary.d.ts#L13</a><br>
// usage in TypeScript (dirty hack!)<br>
<a href="https://github.com/vvakame/language-review/blob/d23f8797bbb6e99d636399a14c7035c4809ab365/lib/util/emissary-helper.ts#L11">https://github.com/vvakame/language-review/blob/d23f8797bbb6e99d636399a14c7035c4809ab365/lib/util/emissary-helper.ts#L11</a></p>