Conditional Types and Infer 10 exercises
Problem

# Distributivity in Conditional Typesself.__wrap_balancer=(t,e,n)=>{n=n||document.querySelector(`[data-br="\${t}"]`);let o=n.parentElement,r=E=>n.style.maxWidth=E+"px";n.style.maxWidth="";let i=o.clientWidth,s=o.clientHeight,c=i/2,u=i,d;if(i){for(;c+1<u;)d=~~((c+u)/2),r(d),o.clientHeight==s?u=d:c=d;r(u*e+i*(1-e))}};self.__wrap_balancer(":Rhd9j6:",1)

In this exercise we're going to examine a little wrinkle in conditional types.

Consider the example below:

`type Fruit = "apple" | "banana" | "orange"type AppleOrBanana = Fruit extends "apple" | "banana" ? Fruit : never// Failstype tests = [Expect<Equal<AppleOrBanana, "apple" | "banana"`
Loading exercise

## Transcript

0:00 In this exercise, we're going to examine a horrible little gotcha with conditional types, and it really extends to this. What we're trying to do is we're saying apple or banana here. We should be able to check, if fruit extends apple or banana, then we return the fruit. Otherwise, we return never.

0:23 know that apple or banana is in here, so we should be able to say apple's in there and banana's in there, so we should return apple or banana, and then we're good to go. This is quite a contrived version of this problem.

0:37 The issue here is something called distributive conditional types. Your job is to look for that in the TypeScript handbook and see if you can work out what's happening here. There are two possible solutions to this problem. Both of them are a little bit tricksy, so good luck.