mypy 0.750+dev.78f2df9d46198563106dd32cb4494678e97d71eb
mypy thinks that the values of a TypedDict yielded by items() or values() are of type object, instead of the Union of all possible values.
As for the keys yielded by keys() or items(), they are upcast to str whereas a Union of Literal would be more precise.
Finally, keys() and items() are incorrectly reported as an AbstractSet instead of KeysView and ItemsView respectively.
from typing_extensions import TypedDict class C(TypedDict): x: float y: int z: str c: C reveal_type(c.keys()) reveal_type(c.items()) reveal_type(c.values())
Actual output:
note: Revealed type is 'typing.AbstractSet[builtins.str*]'
note: Revealed type is 'typing.AbstractSet[Tuple[builtins.str*, builtins.object*]]'
note: Revealed type is 'typing.ValuesView[builtins.object*]'
Expected output:
note: Revealed type is 'typing.KeysView[Literal["x", "y", "z"]]'
note: Revealed type is 'typing.ItemsView[Literal["x", "y", "z"], Union[float, int, str]]'
note: Revealed type is 'typing.ValuesView[Union[float, int, str]]'
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4