all possible keys of an union type : <p>I want to get all available keys of an union type.</p>

<pre><code>interface Foo {
  foo: string;
}

interface Bar {
   bar: string;
}

type Batz = Foo | Bar;

type AvailableKeys = keyof Batz;
</code></pre>

<p>I want to have <code>'foo' | 'bar'</code> as result of <code>AvailableKeys</code> but it is <code>never</code> (as alternative I could do <code>keyof (Foo &amp; Bar)</code>, what produces exact the required type but I want to avoid to repeat the Types).</p>

<p>I found already the issue <a href="https://github.com/Microsoft/TypeScript/issues/12948" rel="noreferrer"><code>keyof</code> union type should produce union of keys</a> at github. I understand the answer, that <code>keyof UnionType</code> should not produce all possible keys.</p>

<p>So my question is: Is there an other way to get the list of all possible keys (it is ok if the verison 2.8 of tsc is required)?</p>
