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
I have a TypedDict class which has TypeVarTuple type argument(s), and that works as I would expect. However, when I try to make a class derived from that base class, I get unexpected errors from mypy. Different errors, actually, depending on whether I use Unpack or the new "star" unpacking syntax.
This all ought to work, though, right?
To Reproduce
# typeddict_typevartuple_310.pyfromcollections.abcimportCallablefromtypingimportGeneric, Tuple, TypedDict, TypeVarfromtyping_extensionsimportTypeVarTuple, UnpackATs=TypeVarTuple('ATs')
RT=TypeVar('RT')
classBaseDict(TypedDict, Generic[Unpack[ATs], RT]):
callback: Callable[[Unpack[ATs]], RT]
arguments: Tuple[Unpack[ATs]]
classDerivedDict(BaseDict[Unpack[ATs], RT]): # E: Unpack is only valid in a variadic positionreturned: RT
Bug Report
I have a
TypedDict
class which hasTypeVarTuple
type argument(s), and that works as I would expect. However, when I try to make a class derived from that base class, I get unexpected errors from mypy. Different errors, actually, depending on whether I useUnpack
or the new "star" unpacking syntax.This all ought to work, though, right?
To Reproduce
Expected Behavior
I would have expected mypy to accept both these versions as correct...
Actual Behavior
... But it fails both of them, with distinct messages (see inline comments).
Your Environment
mypy.ini
(and other config files): n/aThe text was updated successfully, but these errors were encountered: