default value for optional field

Hey! I have a question about handling optional fields with defaults.

I want to define a type where a property is optional in the input, but its value should never be undefined.

If the field is missing entirely, I want to transform the input so that the field is present in the result with a default value.

Using pipe() seems to only work when the property is defined
Was this page helpful?