<p dir="auto">When a tsconfig.json file is used to target a directory instead of an explicit file list, inherited classes aren't guaranteed to be ordered correctly unless they contain /// &lt;reference tags. It would be nice if directory based compilation could work out the order for inherited classes without the need for the extra tags.</p>
<p dir="auto">eg.<br>
If i have an empty tsconfig.json file:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{}"><pre class="notranslate"><code class="notranslate">{}
</code></pre></div>
<p dir="auto">A base class:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/** Base class */
class ServiceBase {
}"><pre class="notranslate"><code class="notranslate">/** Base class */
class ServiceBase {
}
</code></pre></div>
<p dir="auto">And inheriting class:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/** Child class */
class MyService extends ServiceBase {
    constructor(){
        super();
    }
}"><pre class="notranslate"><code class="notranslate">/** Child class */
class MyService extends ServiceBase {
    constructor(){
        super();
    }
}
</code></pre></div>
<p dir="auto">And a project structure like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ProjectDir
--MyService.ts
--ServiceBase.ts
--tsconfig.json"><pre class="notranslate"><code class="notranslate">ProjectDir
--MyService.ts
--ServiceBase.ts
--tsconfig.json
</code></pre></div>
<p dir="auto">The output .js will output the child class before the base class which gives runtime errors:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
/** Child class */
var MyService = (function (_super) {
    __extends(MyService, _super);
    function MyService() {
        _super.call(this);
    }
    return MyService;
})(ServiceBase);
/** Base class */
var ServiceBase = (function () {
    function ServiceBase() {
    }
    return ServiceBase;
})();"><pre class="notranslate"><code class="notranslate">var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
/** Child class */
var MyService = (function (_super) {
    __extends(MyService, _super);
    function MyService() {
        _super.call(this);
    }
    return MyService;
})(ServiceBase);
/** Base class */
var ServiceBase = (function () {
    function ServiceBase() {
    }
    return ServiceBase;
})();
</code></pre></div>
<p dir="auto">If I add a reference comment to my child class, the ordering will be correct:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/// &lt;reference path=&quot;ServiceBase.ts&quot;/&gt;"><pre class="notranslate"><code class="notranslate">/// &lt;reference path="ServiceBase.ts"/&gt;
</code></pre></div>
<p dir="auto">I'd like to not have to do this, since the reference tags no longer seem necessary for most other use cases:</p>
<p dir="auto">Hello,</p>
<p dir="auto">I am having the same issue, which had lot of activity on  codeplex.<br>
<a href="https://typescript.codeplex.com/workitem/627" rel="nofollow">https://typescript.codeplex.com/workitem/627</a></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class A extends B {
  // ...
}

class B {
  // ...
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">A</span> <span class="pl-k">extends</span> <span class="pl-smi">B</span> <span class="pl-kos">{</span>
  <span class="pl-c">// ...</span>
<span class="pl-kos">}</span>

<span class="pl-k">class</span> <span class="pl-smi">B</span> <span class="pl-kos">{</span>
  <span class="pl-c">// ...</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Compiles without error but obviously fails at runtime.</p>