title: How do I use different object types within an array?
body: <p>I tried to use two different object types in an array.</p>
  <p>There was no problem only using it as an object only.</p>
  <p>However, the compile error shows up when used within an array.</p>
  <p>Below are my example codes.</p>
  <pre><code>type OrType = { a: string } | { b: number };
  
  const testObj1: OrType = { a: 'string' };  // OK
  const testObj2: OrType = { b: 12 };  // OK
  const testArr1: OrType[] = [testObj1, testObj2];  // OK
  
  testArr1.map((item) =&gt; item.a);  // [ERROR] Property 'a' does not exist on type 'OrType'. Property 'a' does not exist on type '{ b: number; }'.ts(2339)
  testArr1.map((item) =&gt; item.b);  // [ERROR] Property 'b' does not exist on type 'OrType'. Property 'b' does not exist on type '{ a: string; }'.ts(2339)
  </code></pre>
  <p>How do I use it?</p>