<p dir="auto">Hi,<br>
I like typesctipt a lot and recently I updated my compiler to version 1.6.<br>
I have some classes that were "abstract" and now I want to use the new keywork <code class="notranslate">abstract</code><br>
My question is as follow:<br>
In order to scope the ``this` variable I used the following type of methods when calling them from JQuary/Angular promise:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export class SomeClass {
    public handleCallback = () =&gt; { 
        this.whatEver();
        //... 
    }
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-v">SomeClass</span> <span class="pl-kos">{</span>
    <span class="pl-c1">public</span> <span class="pl-c1">handleCallback</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span> 
        <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-en">whatEver</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-c">//... </span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This will make sure that if I use this callback for an async operation the <code class="notranslate">this</code> variable will be correct.<br>
How do I the same with abstract classes since I can't specify an abstract property?</p>
<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">nightly (1.9.0-dev.20160604-1.0)</p>
<p dir="auto"><strong>Code</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let foo:number|null = 0;

switch(foo) {
  case null:
    break;
  case 0:
    console.log('bar');
}"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">foo</span>:<span class="pl-smi">number</span><span class="pl-c1">|</span><span class="pl-c1">null</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>

<span class="pl-k">switch</span><span class="pl-kos">(</span><span class="pl-s1">foo</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">case</span> <span class="pl-c1">null</span>:
    <span class="pl-k">break</span><span class="pl-kos">;</span>
  <span class="pl-k">case</span> <span class="pl-c1">0</span>:
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'bar'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong><br>
Null check should be allowed</p>
<p dir="auto"><strong>Actual behavior:</strong><br>
Compiler complains "TypeScript Type 'null' is not comparable to type 'number'. (TS2678)"</p>
<p dir="auto"><strong>Note:</strong><br>
If I add an 'if' condition before the switch, the compiler does not complain about either the 'if' or the switch. For instance:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let foo:number|null = 0;

if (foo === null) { console.log('bar'); }

switch(foo) {
  case null:
    break;
  case 0:
    console.log('bar');
}"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">foo</span>:<span class="pl-smi">number</span><span class="pl-c1">|</span><span class="pl-c1">null</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>

<span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">foo</span> <span class="pl-c1">===</span> <span class="pl-c1">null</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'bar'</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-kos">}</span>

<span class="pl-k">switch</span><span class="pl-kos">(</span><span class="pl-s1">foo</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">case</span> <span class="pl-c1">null</span>:
    <span class="pl-k">break</span><span class="pl-kos">;</span>
  <span class="pl-k">case</span> <span class="pl-c1">0</span>:
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'bar'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>