You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Constrained TypeVar default causes false positive error if the default is a TypedDict type #17686
An error occurs when defining a constrained type variable where the default is a TypedDict type. See mypy Playground:
importtypingastclassA(t.TypedDict):
a: intT=t.TypeVar("T", int, A, default=A) # E: TypeVar default must be one of the constraint types [misc]classC(t.Generic[T]): ...
# Using the type variable still correctly gets its defaultreveal_type(C()) # OK: C[TypedDict("A", {"a": int})]
Expected Behavior
No errors
Your Environment
Mypy version used: 1.10.1, 1.11.1
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Activity
Add tests for namedtuple and typeddict (both were unsupported, report…
Support type aliases, `NamedTuple` and `TypedDict` in constrained Typ…