title: how can i get proper type infer when useing union type with optional property as React props type
body: <p>I want ts to infer v type properly when <code>a</code> is optional in union type.</p>
  <pre><code>import React from 'react';
  type A = { a?: false; s: (v: number) =&gt; void };
  type B = { a: true; s: (v: string) =&gt; void };
  type Props = A | B;
  
  const Comp: React.FC&lt;Props&gt; = () =&gt; null;
  const node = &lt;Comp s={(v) =&gt; void 0} /&gt;; // Parameter 'v' implicitly has an 'any' type.
  </code></pre>
  <p>When I change <code>A.a</code> to the required key, the inference is proper.</p>