The following code should produce a type error.
from typing import Generic, TypeVar, TypedDict
class TD1(TypedDict):
a: str
T = TypeVar("T", bound=TD1)
class G(Generic[T]):
def method1(self) -> T:
return {"a": ""} # No error!
This is related to mypy issue python/mypy#11812.