title: Typescript union type not working
body: <p>I have the following classes:</p>
  
  <pre><code>export interface ISimpleUser {
      id: number;
      full_name: string;
  }
  
  
  export interface IMember extends ng.resource.IResource&lt;IMember&gt; {
      id: number;
      project: number;
      user: number|ISimpleUser;
      skills: ISkill[];
      about: string;
      accepted: Boolean;
  
      updated: Date;
      created: Date;
  }
  </code></pre>
  
  <p>At some point I want to iterate over an arroy of members like in the following example:</p>
  
  <pre><code>        return angular.forEach&lt;resources.IMember&gt;(this.project.members,
              (member: resources.IMember) =&gt; {
                  return member.user.id == user.id;
              }).length &gt; 0;
  </code></pre>
  
  <p>But I get this error: </p>
  
  <pre><code>error TS2339: Property 'id' does not exist on type 'number | ISimpleUser'
  </code></pre>
  
  <p>Don't know what is wrong exactly. I see other parts of the code working with the union types.</p>
  
  <p>Thanks.</p>