I have several times had the use of a MergeExclusive
that would support more than two types.
And yes, I can nest multiple uses but I currently had a case where I needed to force the selection of one of five cases. This resulted in a structure like below which is not very readable.
type Example = MergeExclusive<
MergeExclusive<
MergeExclusive<
DialogConfirmButtonProps,
DialogConfirmButtonProps & DialogCancelButtonProps
>,
DialogConfirmButtonProps &
DialogCancelButtonProps &
DialogCustomButtonsProps
>,
MergeExclusive<
DialogConfirmButtonProps & DialogCustomButtonsProps,
DialogCloseButtonProps
>
>
A better and more readable version would be:
type Example = MergeExclusive<
DialogConfirmButtonProps,
DialogConfirmButtonProps & DialogCancelButtonProps,
DialogConfirmButtonProps & DialogCancelButtonProps & DialogCustomButtonsProps,
DialogConfirmButtonProps & DialogCustomButtonsProps,
DialogCloseButtonProps
>
Is this something that is doable and desired? A assume that MergeExclusive
could be extended to support more than two types without a breaking change?
Personally I do not have the competence to do it, otherwise this request would be a PR.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too