Open
Description
Note
I am not sure whether it should be reported here or to the typeshed repo. Reporting here for now. If this is a typeshed issue, I'll gladly open issue there and close this one.
If there is something special in index
field in NamedTuple
, please point out to the corresponding documentation as I failed to find anything on topic.
Description
Type
bug
Code to check
from typing import NamedTuple
class Foo(NamedTuple):
index: str
Actual behavior
test.py:5: error: Incompatible types in assignment (expression has type "str", base class "tuple" defined the type as "Callable[[Tuple[str, ...], Any, int, int], int]")
Expected behavior
No errors while typechecking
Environment
$ mypy -V
mypy 0.560
$ python -V
Python 3.6.4
Behavior is still the same when using mypy from master:
$ mypy -V
mypy 0.570-dev-7192a7578fc47530bbb5382984d289bffa72b30b
$ mypy test.py
test.py:5: error: Incompatible types in assignment (expression has type "str", base class "tuple" defined the type as "Callable[[Tuple[str, ...], Any, int, int], int]")