<p dir="auto">If you define a class that has a property which only has a setter, but not a getter, and then attempt to use the non-existent getter the code will compile, but the getter is undefined, leading to a crash when it is used. For example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class MyClass {

    private theCount: number;

    constructor() {
        this.theCount = 5;
    }

    public set count(i: number) {
        this.theCount = i;
    }
}

window.onload = () =&gt; {
    var obj: MyClass = new MyClass();
    obj.count = 12;
    var num: number = obj.count;
    document.getElementById(&quot;content&quot;).innerHTML = num.toString();
};"><pre class="notranslate"><code class="notranslate">class MyClass {

    private theCount: number;

    constructor() {
        this.theCount = 5;
    }

    public set count(i: number) {
        this.theCount = i;
    }
}

window.onload = () =&gt; {
    var obj: MyClass = new MyClass();
    obj.count = 12;
    var num: number = obj.count;
    document.getElementById("content").innerHTML = num.toString();
};
</code></pre></div>
<p dir="auto">The above will compile, but crashes when reading obj.count.<br>
Surely it would be better if this code did not compile.</p>
<p dir="auto">What, all this business with union types, indeed a veritable managerie of type-related tricks, and we can't make the basics work?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function borked(): number {
    if (false)
        return 1;
}"><pre class="notranslate"><code class="notranslate">function borked(): number {
    if (false)
        return 1;
}
</code></pre></div>
<p dir="auto">I know this will be flagged with the dreaded "By Design", because of some silly JavaScript use case that I can't imagine, but it's such an obviously wrong feature of the language that I can't help raising as an issue. (Apologies if it's a duplicate.)</p>