title: Typescript says it does not satisfy the constraint when really it does
body: <p>Here is the thing : I have two almost identical components, only one is controlled (i.e. gets a <code>variables</code> prop), the other is not (gets a <code>defaultVariables</code> prop). This <code>variables</code> object must be a subtype of <code>Filters</code>. The uncontrolled version adds default filter values. So some keys from <code>Filters</code> must be set to optional when it comes to <code>defaultVariables</code>.</p>
  
  <p>This gives me the following :</p>
  
  <pre class="lang-js prettyprint-override"><code>// Tool for making only some keys optional :
  
  type Optional&lt;TVariables, K extends keyof TVariables&gt; = Omit&lt;TVariables, K&gt; &amp;
    Partial&lt;Pick&lt;TVariables, K&gt;&gt;;
  
  // The filter base variables found in every TVariables :
  
  type Filters = {
    search: string | null;
    sort: string | null;
    sortOrder: number | null;
    limit: number;
    page: number;
  };
  
  // Component props, controlled and uncontrolled versions :
  
  type Props&lt;TVariables extends Filters&gt; = {
    variables: Omit&lt;TVariables, 'page'&gt;;
    // ... other props, irrelevant here
  };
  
  type UncontrolledProps&lt;TVariables extends Filters&gt; = Omit&lt;
    Props&lt;TVariables&gt;,
    "variables"
  &gt; &amp; {
    defaultVariables: Optional&lt;Props&lt;TVariables&gt;["variables"], "limit"&gt;;
  };
  </code></pre>
  
  <p><strong>But</strong>, error on the last line :</p>
  
  <pre><code>Error:(467, 62) TS2344: Type '"limit"' does not satisfy the constraint 'Exclude&lt;keyof TVariables, "page"&gt;'.
  </code></pre>
  
  <p>But really, this doesn't make sense. With the constraint <code>Filters</code> set to the generic <code>TVariables</code>, <code>Exclude&lt;keyof TVariables, "page"&gt;</code> should by definition at least be <code>"search" | "sort" | "sortOrder" | "limit"</code>.</p>
  
  <p>So what's the problem here ?</p>