Closed navndn closed 4 years ago
@navndn thank you for reporting this issue :)
It looks that your initial typings are wrong, field x
is not str
, it's Optional[str]
.
Please try:
from typing import Optional
@dataclass
class A():
x: Optional[str] = None
I have a use-case similar to below code ...
Error:
Is this expected behaviour? Is there a work-around other than using custom asdict function which skips None valued keys?
Thanks!