Closed
Description
Mypy does not detect the subtype relation (correct term?) when it comes to dict
values:
if False:
from typing import Union
# works
foo1 = 0 # type: int
bar1 = foo1 # type: Union[int, str]
# "Incompatible types in assignment"
foo2 = {} # type: dict[str, int]
bar2 = foo2 # type: dict[str, Union[int, str]]
Mypy 0.4.5