Typing issue with chex.dataclass
wookayin opened this issue · 2 comments
wookayin commented
Static type checkers like pyright, mypy, etc. will think chex.dataclass
-decorated dataclass has a constructor with no parameters.
Example:
@chex.dataclass(frozen=True)
class Foo:
a: int
b: int
However, Foo()
is not a valid call: A legitimate call would be something like Foo(a=1, b=2)
. This does not agree with static type checker's analysis.
Compare the behavior with built-in dataclass:
tmke8 commented
This can be solved with dataclass_transform. I can send a PR if desired.