I am trying to use the TypeVar T inside Generic class: in a _dataclass_helper
MyPy error in the "value"
from typing import Generic, TypeVar
from dataclasses import dataclass
_T = TypeVar("_T")
class Base(Generic[_T]):
@dataclass
class _dataclass_helper:
value: _T #<<--- mypy: Type variable "HW.DC_ValueGeneric._T" is unbound
string: str
def __init__(self):
pass
# using _dataclass_helper in the code
I have tried to have _dataclass_helper as Generic,
or either to define the _dataclass_helper outside the scope of Base...
But both miss the target