title: Generics and nullish types
body: <p>Say I'm interested in a generic function that will give a compile time error if called with arguments of different types.</p>
  <p>Initially, I've tried something like that:</p>
  <pre><code>type genericFunc = {
      &lt;T&gt;(a:T, b:T): boolean
  }
  
  let isEq: genericFunc = (a,b) =&gt; { return a === b }
  </code></pre>
  <p>When I try to call it like so:</p>
  <pre><code>isEq(1,&quot;str&quot;)
  </code></pre>
  <p>I get a compile time error, as expected. However, when I try to:</p>
  <pre><code>isEq(1, null)
  </code></pre>
  <p>or:</p>
  <pre><code>isEq(1, undefined)
  </code></pre>
  <p>It all compiles without complaining. Per vscode, the type of <code>isEq(1, null)</code> is inferred to as:</p>
  <pre><code>let isEq: &lt;number | null&gt;(a: number | null, b: number | null) =&gt; boolean
  </code></pre>
  <p>Setting <code>&quot;strictNullChecks&quot;: true</code> in my tsconfig.json does not change that.</p>
  <p>To summarize, I'm interested in the following questions:</p>
  <ol>
  <li>Why are the types inferred this way?</li>
  <li>Should I define the type <code>genericFunc</code> differently?</li>
  <li>Is there a way to enforce a stricter type inference when generics and nullish types are involved?</li>
  </ol>
  <p>Many Thanks!</p>