<p dir="auto">I hope this is not a dupe, I was really surprised by this bug because - being so simple in nature - it appears it should have been caught by your tests (or at least stumbled upon by other people), hence there is a slight probability that I misunderstood something or that the compiler isn't capable to do the necessary work (at which point I'd be doubly disappointed).</p>
<p dir="auto">Anyway, the example is artificial because it's extracted from a larger code base.</p>
<p dir="auto">Imagine a simple project, let's start with <code class="notranslate">tsconfig.json</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
    &quot;compilerOptions&quot;: {
        &quot;target&quot; : &quot;ES5&quot;,
        &quot;noImplicitAny&quot;: true,
        &quot;out&quot;: &quot;badout.js&quot;
    }
}"><pre class="notranslate"><code class="notranslate">{
    "compilerOptions": {
        "target" : "ES5",
        "noImplicitAny": true,
        "out": "badout.js"
    }
}
</code></pre></div>
<p dir="auto">In the same folder, add a single file <code class="notranslate">c.ts</code> which is just <code class="notranslate">class C {}</code></p>
<p dir="auto">Add a subfolder called <code class="notranslate">sub</code> and put the following two files inside:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// file a.ts
class A extends B {
    method1(p1:number, p2:string):void {}
}"><pre class="notranslate"><code class="notranslate">// file a.ts
class A extends B {
    method1(p1:number, p2:string):void {}
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// file b.ts
class B {
    method1(p1:number, p2:string):void {}
}"><pre class="notranslate"><code class="notranslate">// file b.ts
class B {
    method1(p1:number, p2:string):void {}
}
</code></pre></div>
<p dir="auto">Then simply run tsc in the project folder (the one containing <code class="notranslate">tsconfig.json</code> and <code class="notranslate">c.ts</code>)</p>
<p dir="auto">The output will be:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var C = (function () {
    function C() {
    }
    return C;
})();
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 __();
};
var A = (function (_super) {
    __extends(A, _super);
    function A() {
        _super.apply(this, arguments);
    }
    A.prototype.method1 = function (p1, p2) { };
    return A;
})(B);
var B = (function () {
    function B() {
    }
    B.prototype.method1 = function (p1, p2) { };
    return B;
})();"><pre class="notranslate"><code class="notranslate">var C = (function () {
    function C() {
    }
    return C;
})();
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 __();
};
var A = (function (_super) {
    __extends(A, _super);
    function A() {
        _super.apply(this, arguments);
    }
    A.prototype.method1 = function (p1, p2) { };
    return A;
})(B);
var B = (function () {
    function B() {
    }
    B.prototype.method1 = function (p1, p2) { };
    return B;
})();
</code></pre></div>
<p dir="auto">The problem is obvious - we're trying to use <code class="notranslate">B</code> before it is defined.</p>
<p dir="auto">If this has been noted and fixed, please forgive the noise.</p>
<p dir="auto">If not, please try to look into fixing this before 1.5 is "done".</p>
<p dir="auto">The compiler should issue an error when code uses values before they could possibly be initialized.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Error, 'Derived' declaration must be after 'Base'
class Derived extends Base { }
class Base { }"><pre class="notranslate"><span class="pl-c">// Error, 'Derived' declaration must be after 'Base'</span>
<span class="pl-k">class</span> <span class="pl-smi">Derived</span> <span class="pl-k">extends</span> <span class="pl-smi">Base</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-k">class</span> <span class="pl-smi">Base</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span></pre></div>