Open d00mw01f opened 3 years ago
Try setting nullabilityDefinition parameter to undefinedInlineUnion
, see also #648.
This setting fixes optional properties but breaks list:
export interface Test {
list: (string | undefined)[];
text?: string;
}
The list contains null and string, while the interface says that it can contain undefined and string. So I don't want to change nullability behavior, I want to change optional behavior to exclude nullability.
Aha, ok. I am afraid currently this is not possible. But with Include.NON_NULL
(somehow configured also in typescript-generator) this null
could be eliminated as it is done for undefined
.
Ok, thanks for the response. I would be happy to use this feature sometime.
Hi,
I read old pull request about nullability and I'm trying to achieve similar behavior:
For example I wish to use:
With enabled JsonInclude.Include.NON_NULL serialized object will look the same as in the ticket:
But Typescript annotations with OptionalProperties.useLibraryDefinition would be
Is there any way to make optional types get rid of nullability? E.g.:
Thanks.