title: Difficulties to understand Typescript's distributive logic
body: <p>So, I understand that <a href="https://stackoverflow.com/a/55383816/11153160">naked type parameter checks are distributive</a>, thus :</p>
  <pre class="lang-js prettyprint-override"><code>type B&lt;T&gt; = T extends true ? &quot;X&quot; : &quot;Y&quot;;
  type C = B&lt;true | false&gt;; // &quot;X&quot; | &quot;Y&quot;
  </code></pre>
  <p>But here is where I get lost :</p>
  <ol>
  <li><code>T</code> isn't naked in <code>A&lt;T&gt;</code>, but you still get distributivity :</li>
  </ol>
  <pre class="lang-js prettyprint-override"><code>type A&lt;T&gt; = T;
  type B&lt;T&gt; = A&lt;T&gt; extends true ? &quot;X&quot; : &quot;Y&quot;;
  type C = B&lt;true | false&gt;; // &quot;X&quot; | &quot;Y&quot; (??)
  </code></pre>
  <ol start="2">
  <li>It gets weirder : distributivity goes away when infering <code>T</code> in <code>A</code> to itself :</li>
  </ol>
  <pre class="lang-js prettyprint-override"><code>type A&lt;T&gt; = T extends infer U ? U : never;
  type B&lt;T&gt; = A&lt;T&gt; extends true ? &quot;X&quot; : &quot;Y&quot;;
  type C = B&lt;true | false&gt;; // &quot;Y&quot; (??)
  </code></pre>
  <ol start="3">
  <li>But it comes back when infering in <code>B</code> directly :</li>
  </ol>
  <pre class="lang-js prettyprint-override"><code>type B&lt;T&gt; = T extends infer U ? (U extends true ? &quot;X&quot; : &quot;Y&quot;) : never;
  type C = B&lt;true | false&gt;; // &quot;X&quot; | &quot;Y&quot; (??)
  </code></pre>
  <p>Can you help me understand what's going on ? Thank you.</p>