title: Typescript check if type A === type B | type C
body: <p>In one file I have something like this:</p>
  
  <pre><code>export const _all = {
    a: '',
    b: '',
    c: '',
    d: '',
    e: '',
    f: '',
  }
  type AllKeysType = typeof _all;
  export type AllKey = keyof AllKeysType;
  </code></pre>
  
  <p>In another file I have something like this:</p>
  
  <pre><code>export const _keep = {
    a: '',
    b: '',
    d: '',
    e: '',
  }
  type KeepKeysType = typeof _keep;
  export type KeepKey = keyof KeepKeysType;
  
  export const _ignore = {
    c: '',
    f: '',
  }
  type IgnoreKeysType = typeof _ignore;
  export type IgnoreKey = keyof IgnoreKeysType;
  </code></pre>
  
  <p>How can I use Typescript to assert that the keys defined in <code>_all</code> ALWAYS is equal to the union of <code>_keep</code> and <code>_ignore</code>.  In other words, <code>AllKey</code> should always be equal to <code>KeepKey</code> | <code>IgnoreKey</code>.</p>
  
  <p>I want the Typescript compiler to give me an error if a developer updates <code>_all</code> by adding in a new value (say <code>z</code>) but forgets to add <code>z</code> into either <code>_keep</code> or <code>_ignore</code>.</p>