Closed silversonicaxel closed 8 months ago
ConditionalExcept
should work:
type B = ConditionalExcept<A, boolean>;
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):
type B = ConditionalExcept<Required<A>, boolean>;
I would like to know if it is possible to have a scenario like this one:
where type B looks like this
Upvote & Fund