This is the idiomatic usage pattern for optional(custom(...)).
optional only affects serialization so we must make sure to check
if the value is undefined or not, if yes, serialize, else, return undefined
which will be processed by optional(...) as SKIP.
This is the idiomatic usage pattern for
optional(custom(...)).optionalonly affects serialization so we must make sure to check if the value isundefinedor not, if yes, serialize, else, returnundefinedwhich will be processed byoptional(...)asSKIP.optionaldoes not affect deserialization, however, asundefinedvalues are automatically skipped See https://github.com/mobxjs/serializr/issues/73#issuecomment-535641545