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
…in (#14854)
Fixes: #14853
Adding support for `if` statements in the `dataclass` and `dataclass_transform` decorators, so
the attributes defined conditionally are treated as those that are
directly in class body.
Bug Report
When using
typing.dataclass_transform
(PEP 681) attributes defined inif TYPE_CHECKING
are not treated as__init__
arguments.On
mypy==1.1.1
the same happens for all three ways of usingdataclass_transform
(code on playground is defining all of them).On version
mypy==1.0.0
only theDecorator function
is having issues.Pyright is reporting no issues with the code.
To Reproduce
Playground
Playground have
mypy==1.0.0
, so it only shows error forFunctionModel
, but when running code from it onmypy==1.1.1
three errors are shownPart of the code:
Actual Behavior
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: