Closed
Description
AFAICT, there is no broadly-functional implementation of Exclude/Omit that works when there's a union in the remaining difference. I'd suggest that perhaps Exclude might be enhanced to handle this case.
The Omit
implementations I'm aware of rely on keyof
, which doesn't include any members of one union member that aren't present in all. This is by design; see #12948.
2.8's Exclude
won't work on such a type at all, complaining that it's not an interface
.
This blocked one route in my particular production (one of many!) of "The Failed Quest for a Typescript React HOC Declaration With Generic Inferencing That Works". See mui/material-ui#11003 (likely to be rolled back soon).