Hi,
I am trying to use generic NamedTuple from the new typing_extensions, however static checkers can't resolve its import.
Below is the code to reproduce and mypy errors as comments.
fromtypingimportTypeVar, Genericfromtyping_extensionsimportNamedTuple# error: Module "typing_extensions" has no attribute "NamedTuple"T_co=TypeVar('T_co', covariant=True)
classFoo(NamedTuple, Generic[T_co]): # error: Class cannot subclass "NamedTuple" (has type "Any")bar: T_coNot sure what the problem is. I see that there's a conditional here that checks for Python 3.11. It might be the case that type checkers can't resolve this statically. This is just a hypothesis though.
Environment
Python 3.8.10
typing_extensions==4.3.0
mypy==0.942
Hi,
I am trying to use generic
NamedTuplefrom the newtyping_extensions, however static checkers can't resolve its import.Below is the code to reproduce and
mypyerrors as comments.Not sure what the problem is. I see that there's a conditional here that checks for Python 3.11. It might be the case that type checkers can't resolve this statically. This is just a hypothesis though.
Environment
Python 3.8.10