Name of the property
The value to use if the field is absent
The decoder to run on the value of that property
const decoder = Decode.optionalField('value', 100, Decode.integer);
decode(decoder, { value: 42 }) === 42
decode(decoder, {}) === 100
decode(decoder, 42) // Fails
Generated using TypeDoc
Same as Decode.field, but it doesn't fail when the property is not present on the object. In that case, the provided value is returned.