Relaxes the keys of an object type into optional keys wherever the value type admits absence.
Marks every key whose type includes undefined as an optional key and leaves the rest required,
so a value literal spells out only the entries it actually carries instead of padding absent ones
with undefined. Reading is unaffected: an omitted key still yields undefined.
Used by Prototype to relax template entries whose cardinality admits absence. The
modifiers are carried into State by Slots,
which preserves them as it projects the template, so nested and inherited entries relax alongside
local ones.
Type Parameters
P
The object type to relax
Remarks
Apply to an already projected template rather than folding the undefined test into the
projection itself: repeating the projection inside the key filter multiplies its instantiation
depth and exhausts the compiler's recursion budget on deeply nested shapes.
Relaxes the keys of an object type into optional keys wherever the value type admits absence.
Marks every key whose type includes
undefinedas an optional key and leaves the rest required, so a value literal spells out only the entries it actually carries instead of padding absent ones withundefined. Reading is unaffected: an omitted key still yieldsundefined.Used by Prototype to relax template entries whose cardinality admits absence. The modifiers are carried into State by Slots, which preserves them as it projects the template, so nested and inherited entries relax alongside local ones.