Closed
Description
Bug Report
a.py:
from typing import Optional
from typing import TypedDict
class D(TypedDict):
a: int
v: Optional[D]
v and v['a']
class P(TypedDict):
v: Optional[D]
p: P
p['v'] and p['v']['a']
To Reproduce
mypy a.py
Expected Behavior
No error report
Actual Behavior
a.py:16: error: Value of type "Optional[D]" is not indexable
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags: no flags
- Mypy configuration options from
mypy.ini
(and other config files): no config file - Python version used: Python 3.9.4