Bug Report
Error for a valid input to TypedDict | dict[int, float]
To Reproduce
https://mypy-play.net/?gist=3d0a2913c33c47b405cb297df1607e8f
fromtypingimportTypedDictclassFoo(TypedDict):
some: strname: str
type Bar=dict[int, float]
type Baz=Foo|Barbaz: Baz= {"some": "foo", "name": "x"} # OKbar: Bar= {1: 5.2, 2: 7.4} # OKbaz2: Baz= {1: 5.2} # error: Expected TypedDict key to be string literal [misc]Expected Behavior
I would expect baz2 to be valid
Actual Behavior
main.py:14: error: Expected TypedDict key to be string literal [misc]
Found 1 error in 1 file (checked 1 source file)
When mis-typing the dict variant mypy does give an expected error:
baz3: Baz= {"1": 5.2} # error: Dict entry 0 has incompatible type "str": "float"; expected "int": "float" [dict-item]Your Environment
Original discussion: python/typing#2292
Bug Report
Error for a valid input to
TypedDict | dict[int, float]To Reproduce
https://mypy-play.net/?gist=3d0a2913c33c47b405cb297df1607e8f
Expected Behavior
I would expect
baz2to be validActual Behavior
When mis-typing the dict variant mypy does give an expected error:
Your Environment
Original discussion: python/typing#2292