title: Type 'undefined' is not assignable to type 'number' .ts(2322)
body: <p>I'm stuck in learning Typescript language and need some explanations. The problem is that variable named as <code>this.value</code> is never assigned as undefined due <code>isValid</code> function check it. How to make typescript understand it?</p>
  <pre><code>export const isValid = (n: any) =&gt; n &amp;&amp; n &gt; 0 &amp;&amp; n &lt; 10;
  
  class Test {
      value: number;
      constructor(value?: number) {
          /*
          Type 'number | undefined' is not assignable to type 'number'.
          Type 'undefined' is not assignable to type 'number'.ts(2322)
          */
          this.value = isValid(value) ? value : -1;
      }
  }
  </code></pre>