Closed
Description
The following MWE:
from typing import Generic, TypeVar
import dataclasses
T = TypeVar('T')
@dataclasses.dataclass()
class A(Generic[T]):
attr: T
A(attr=0) # OK!
@dataclasses.dataclass()
class B(A[float]):
...
B(attr=float(0))
# Argument "attr" to "B" has incompatible type "float"; expected "T"
fails with "Argument "attr" to "B" has incompatible type "float"; expected "T"" error in mypy. But the B
class specifies T
to be float
, how to fix that error?
Metadata
Metadata
Assignees
Labels
No labels