Not sure if this is a duplicate but I couldn't find the problem in the open issues. If I overlooked it, please close, of course.
from attrs import define, field
from attrs.validators import instance_of
LeTypeAlias = int | str
@define
class LeClass:
x: LeTypeAlias = field(validator=instance_of(LeTypeAlias))
Works perfectly but mypy complains about:
error: No overload variant of "instance_of" matches argument type "UnionType[int, str]" [call-overload]
Not sure if this is a duplicate but I couldn't find the problem in the open issues. If I overlooked it, please close, of course.
Works perfectly but
mypy
complains about: