title: Merge dicts with different key types
body: <p>When trying to merge dictionaries with different key types:</p>
  <pre><code>a: dict[int, str] = {5: &quot;hohoho&quot;}
  b: dict[str, str] = {&quot;hi&quot;: &quot;hello&quot;}
  
  c = a | b
  </code></pre>
  <p>Mypy version 0.812 complains with <code>mypy_dict_merge.py:4: error: Unsupported operand types for | (&quot;Dict[int, str]&quot; and &quot;Dict[str, str]&quot;)</code></p>
  <p>I expected mypy to infer a type <code>Dict[Union[int, str], str]</code>. I found that I can do</p>
  <pre><code>c = cast(dict[Union[int, str], str], a) | cast(dict[Union[int, str], str], a)
  </code></pre>
  <p>But that feels a bit clumsy, and there is no check that the <code>cast</code> makes any sense. Is there a better way?</p>
  <p><strong>Edit:</strong> As users have pointed out that I should just use different types in the first place - this is a simplified example, let's assume a and b just store the results of functions, and I cannot modify those functions. So</p>
  <pre><code>a = function_that_returns_dicts_with_keys_of_type_Apple()
  b = function_that_returns_dicts_with_keys_of_type_Orange()
  c = a | b
  </code></pre>