#[serde(default)] fields are non-optional
#430
-
|
In serde makes e.g. With The serde-compat section of the readme claims that the I tried to work around it but I'm not sure if this is a bug or something that's difficult to achieve parity on and should have a specific call-out in the documentation. In the meantime though, is there a way to work around this at the attribute level (i.e. without changes to structure definitions?). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hey @andrewbaxter! This is not a bug, |
Beta Was this translation helpful? Give feedback.
Hey @andrewbaxter! This is not a bug,
#[ts(optional)]only works with theOptiontype. That's why you see theIsOptionerror.You can use
#[ts(as = "Option<_>", optional)]to achieve the result you want