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
from typing import TypedDict
class A(TypedDict):
a: str
def foo(a: A):
for v in reveal_type(a.values()):
v.lower()
This produces:
test.py:7: note: Revealed type is 'typing.ValuesView[builtins.object]'
test.py:8: error: "object" has no attribute "lower"
Found 1 error in 1 file (checked 1 source file)
Expected Behavior
TypedDict.values() to return a different type if all values of a TypedDict are of the same type.
Your Environment
Mypy version used: 0.910
The text was updated successfully, but these errors were encountered:
I think when I use TypedDict, I'm always thinking about it as not allowing additional keys. So, I guess a final type is probably what I'm missing (though, generally, I'd still like it to be subclassable, just the opposite of total=False).
This produces:
Expected Behavior
TypedDict.values()
to return a different type if all values of aTypedDict
are of the same type.Your Environment
The text was updated successfully, but these errors were encountered: