title: TS2367: This condition will always return 'false' with any
body: <p>I am having difficulty understanding why the compiler excludes <code>null</code> from the set of types possible for <code>arg</code> (or alternatively I do not understand the diagnostic message).</p>
  
  <pre><code>    static vetStringNullable(arg:any): string|null {
          if (typeof arg === 'string') {
              return arg;
          }
          if (typeof arg === 'null') {
              return arg;
          }
          throw TypeError('Vetted value is not of type string or null.');
      }
  </code></pre>
  
  <p>The above code yields the following compiler diagnostic:</p>
  
  <pre><code>TS2367: This condition will always return 'false' since the types '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"null"' have no overlap.
  </code></pre>
  
  <p>Edit: In light of the accepted answer, I have changed the function as follows:</p>
  
  <pre><code>    static vetStringNullable(arg:any): string|null {
          if (typeof arg === 'string' || arg === null) {
              return arg;
          }
          throw TypeError('Vetted value is not of type string or null.');
      }
  </code></pre>