title: How do I use multiple interfaces for one object in typescript
body: <p>I have to check an object. That may have different signatures. It should accept type and svc or id. Therefore I have two interfaces:</p>
  <pre><code>interface A {
    type: string;
    svc: string;
  }
  interface B {
    id: string;
  }
  </code></pre>
  <p>I saw an example, where they used a type and both interface combined with &quot;or&quot;:</p>
  <pre><code>export type AB = A | B;
  
  func(config: AB) {
    if (config.type ) {
      ...
    }
  }
  </code></pre>
  <p>But this delivers an TS error in IDE:</p>
  <blockquote>
  <p>TS2339: Property 'type' does not exist on type 'AB'. Property 'type'
  does not exist on type 'B'.</p>
  </blockquote>
  <p>How is the correct way to implement this?</p>