title: TypeScript: Require that two arrays be the same length?
body: <p>Say I'm making a <code>Tab</code> + <code>Panel</code> component called <code>TabsPanels</code>. I want to ensure that I'm getting the same number of <code>Tab</code> and <code>Panel</code> components, like so:</p>
  
  <pre><code>type TabsPanelsProps = {
    tabs: Tab[];
    panels: Panel[];
  }
  </code></pre>
  
  <pre><code>&lt;TabsPanels
    tabs={[&lt;Tab/&gt;, &lt;Tab/&gt;]}
    panels={[&lt;Panel/&gt;]} // Error: tabs.length and panels.length do not match
  /&gt;
  </code></pre>
  
  <p>Is there any way to do this? If there was some utility function like</p>
  
  <pre><code>PropsAreEqual&lt;T, K1, K2, P&gt;
  where
  T = type
  K1 = key 1
  K2 = key 2
  P = the property to be equal
  </code></pre>
  
  <p>That's obviously bad, but you get what I'm saying. Then you could do</p>
  
  <pre><code>PropsAreEqual&lt;TabsPanelsProps, 'tabs', 'panels', 'length'&gt;
  </code></pre>