Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Exclude when the difference contains a union. #23862

Closed
estaub opened this issue May 3, 2018 · 2 comments
Closed

Allow Exclude when the difference contains a union. #23862

estaub opened this issue May 3, 2018 · 2 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@estaub
Copy link

estaub commented May 3, 2018

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).

@estaub estaub changed the title Allow Exclude when the remainder contains a union. Allow Exclude when the difference contains a union. May 3, 2018
@RyanCavanaugh
Copy link
Member

Some example code of what you're trying to do would be great

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label May 4, 2018
@estaub
Copy link
Author

estaub commented May 4, 2018

Sorry, this is why one should never write an issue without the code in front of you. I got Exclude and 'extends?' (conditional typing) befuddled. Closing.

@estaub estaub closed this as completed May 4, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

2 participants