My bad, should have said something instead of just plopping down a solution - yes you are correct saying that:
type AllCandiesWithoutPeanuts = HasPeanuts<AllCandies>
is the opposite of the solution. Something more correct would have the inverted type. I'm not sure how one would go from HasPeanuts to something like OmitsPeanuts but declaring it from scratch is straightforward:
type OmitsPeanuts<A> = A extends { peanuts: true } ? never : A;
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My bad, should have said something instead of just plopping down a solution - yes you are correct saying that:
is the opposite of the solution. Something more correct would have the inverted type. I'm not sure how one would go from
HasPeanuts
to something likeOmitsPeanuts
but declaring it from scratch is straightforward: