-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
With the following example I get an error.
from mypy_extensions import TypedDict
class Test(TypedDict):
a: str
b: str
def read(test: Test) -> str:
key = 'a'
return test[key]
error: TypedDict key must be a string literal; expected one of ('a', 'b')
Can mypy not figure out that key
is set to a literal?
In my own code im building up key
dynamically to get a key from a TypedDict.
mypy version: 0.711
stevanmilic, pawelrubin, btorresgil, vbrozik, federicovallucci and 20 more
Metadata
Metadata
Assignees
Labels
No labels