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

DeepExclude #9

Open
brentjanderson opened this issue Apr 7, 2020 · 1 comment
Open

DeepExclude #9

brentjanderson opened this issue Apr 7, 2020 · 1 comment

Comments

@brentjanderson
Copy link

I've tried this but it doesn't quite get me where I want to go:

type DeepExclude<T, U> = {
  [P in Exclude<keyof T, U>]: T[P] extends Array<infer I> ? Array<DeepExclude<I, U>> : DeepExclude<T[P], U>;
};

Curious if this is something easily solvable in TypeScript? I have a different implementation, but it's a mess consisting of about 30 conditional checks that's use-case specific. I think a DeepExclude would be a better utility, and meet my specific use-case pretty well. Thoughts?

@domoritz
Copy link

https://stackoverflow.com/a/64900252/214950 works pretty well for me. Can you take it for a spin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants