title: Constrain tuple values where 2nd value is constrained by the 1st value
body: <p>I can do the following easily with a function, but to create a simpler API for the consumer I want to do it with a tuple.</p>
  <p>Say I have 2 simple React components that take different props:</p>
  <pre><code>const Text = ({ value }: { value: string }) =&gt; &lt;span&gt;{value}&lt;/span&gt;;
  const PrefixedText = ({ prefix, value }: { prefix: string; value?: string }) =&gt; (
    &lt;span&gt;{value ? `${prefix}${value}` : ''}&lt;/span&gt;
  );
  </code></pre>
  <p>And an object that references them:</p>
  <pre><code>const renderPropMap = {
    text: Text,
    prefixedText: PrefixedText
  };
  
  type RenderPropMap = typeof renderPropMap;
  </code></pre>
  <p>Now I want to create a type that is a tuple where the 1st element is a key of renderPropMap ('text' or 'prefixedText') and the 2nd element is the props of the component at the key of the given 1st element. AND I would like the IDE to auto-suggest the 2nd element once the first has been entered.</p>
  <p>I can easily create a function that does this with its arguments and returns the desired tuple:</p>
  <pre><code>type RenderProps&lt;R extends keyof RenderPropMap&gt; = [R, Parameters&lt;RenderPropMap[R]&gt;[0]];
  function setRender&lt;R extends keyof RenderPropMap&gt;(...args: RenderProps&lt;R&gt;) {
    return args;
  }
  </code></pre>
  <p>Now when I pass 'text' as the first parameter it auto-suggests { value: string } for the second parameter, and similarly if I pass 'prefixedText' is suggests { value?: string, prefix: string }. Also Typescript infers R from the first parameter so the consumer doesn't need to pass in the type parameter. Nice.</p>
  <p>But as I said, I don't want to use a function, I just want the consumer to provide a tuple. I was able to come up with this:</p>
  <pre><code>type ComponentRef = 'text' | 'prefixedText';
  type RenderPropsTuple = ComponentRef extends infer R
    ? R extends ComponentRef
      ? RenderPropMapValue&lt;R&gt; extends (...args: any) =&gt; JSX.Element
        ? [R, Parameters&lt;RenderPropMapValue&lt;R&gt;&gt;[0]]
        : never
      : never
    : never;
  </code></pre>
  <p>Now Typescript does complain if I define an invalid tuple BUT I don't get auto-suggestion for the 2nd element. In fact I get auto-suggestion of all the possible props for both components no matter which key I put as the first element.</p>