You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe we should support overloading based on the structure of a TypedDict. For example, this could be okay, even though it's currently considered overlapping:
fromtypingimportoverloadfrommypy_extensionsimportTypedDictA=TypedDict('A', {'x': int})
B=TypedDict('B', {'y': str})
@overloaddeff(x: A) ->int: ...
@overloaddeff(x: B) ->str: ...
deff(x): ...
a: Ab: Bf(a) # Should be intf(b) # Should be str
However, some overloads should probably still be considered invalid as they overlap, such as if two TypedDicts have the same keys and some value types overlap. Another special case to consider is non-total TypedDicts.
Maybe we should support overloading based on the structure of a TypedDict. For example, this could be okay, even though it's currently considered overlapping:
However, some overloads should probably still be considered invalid as they overlap, such as if two TypedDicts have the same keys and some value types overlap. Another special case to consider is non-total TypedDicts.
Discussion here: #3612 (comment)
The text was updated successfully, but these errors were encountered: