[issue47166] Dataclass transform should ignore TypeAlias variables

Thomas MK report at bugs.python.org
Wed Apr 6 18:47:22 EDT 2022


Thomas MK <tmke at posteo.net> added the comment:

There is of course no hard reason for not using the global scope. I just often have enums (or other types) that are very closely linked to one class. And it makes sense to me then to have a TypeAlias in that class so that I don't have to import the enum separately.

For normal classes, the nested TypeAlias works completely fine in the type checkers I tested (pyright and mypy). It's just dataclasses that are the problem.

But I see now that there is a general wish to keep the implementation of dataclass simple, which I can understand.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47166>
_______________________________________


More information about the Python-bugs-list mailing list