We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I would like to know if it is possible to have a scenario like this one:
type A = { a: string; b: number; c: boolean; d: boolean; e: boolean; }; type B = Omit<A, boolean>;
where type B looks like this
type B = { a: string; b: number; };
The text was updated successfully, but these errors were encountered:
ConditionalExcept should work:
ConditionalExcept
type B = ConditionalExcept<A, boolean>;
Sorry, something went wrong.
Amazing, last part of question is, what if one boolean is optional? Because now, considering this example:
type A = { a: string; b: number; c: boolean; d?: boolean; e: boolean; }; type B = ConditionalExcept <A, boolean>;
type B looks like this:
type B = { a: string; b: number; d?: boolean; };
d?: boolean is the same as d: boolean | undefined (for most cases). One solution is to use the built-in Required utility type (TS Playground):
d?: boolean
d: boolean | undefined
Required
type B = ConditionalExcept<Required<A>, boolean>;
No branches or pull requests
I would like to know if it is possible to have a scenario like this one:
where type B looks like this
Upvote & Fund
The text was updated successfully, but these errors were encountered: