title: VS Code not recognizing a function returning `never` and giving "Object is possibly 'undefined'" error
body: <pre><code>tsc --version: Version 2.5.2
  Visual Studio Code Version: Version 1.16.1 (1.16.1) 27492b6bf3acb0775d82d2f87b25a93490673c6d
  </code></pre>
  
  <p>I am having some trouble with Visual Studio Code recognizing that I've tested for an object's nullability and it will <code>never</code> return if null.  VSCode will still believe that later uses of the object will possibly be null.</p>
  
  <p>I can appreciate that it'd be difficult to detect this condition.  I had hoped that the <code>// @ts-ignore</code> would work in .ts files directly, as I'd really like to suppress/ignore this warning.</p>
  
  <p>Consider the following <code>never</code> function and its use:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function FatalError(message: string): never
  {
   throw new Error(message);
  }
  interface ITest
  {
   field1: number;
   field2: string;
  }
  function MyTest(args: ITest | null)
  {
   var test: number;
  
   if (!args) FatalError("Unexpected value.");
  
   var test = args.field1;
  }
  MyTest({field1: 1, field2: "test"});</code></pre>
  </div>
  </div>
  </p>
  
  <p>In VSCode, the red squiggly will appear under <code>args</code> of the <code>var test = args.field1;</code> line at the bottom, with the following:</p>
  
  <pre><code>[ts] Object is possibly 'null'.
  (local var) test1: null
  </code></pre>
  
  <p>If I change my null check to something like the following:</p>
  
  <pre><code>if (!args) { FatalError("Unexpected value."); return; }
  </code></pre>
  
  <p>Then the compiler is satisfied that the null check has been done and the program control flow stops, such that subsequent uses of the variable avoid the <code>"Object is possibly 'null'"</code> error.  But, I feel like the <code>never</code> keyword should have accomplished the same thing.</p>
  
  <p>What am I missing?</p>
  
  <p>Edit:  my tsconfig.json settings are:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>{
    "compilerOptions":
    {
      "target": "es2016",
      "module": "es2015",
      "strict": true
    }
  }</code></pre>
  </div>
  </div>
  </p>