title: Rxjs, return Type
body: <p>I have probleme with that code. I need to get date in depends condition, but in subscribe I get not the correct type.</p>
  <pre><code>of (''). pipe (
         takeUntil (this.destroyer $),
         switchMap (() =&gt; {
           if (this.isITVPlatformClient) {
             // return FirstType
             return this.firstService.GetData ();
           } else {
             // return [SecondType | ThirdType]
             return forkJoin (
               this.secondService.GetData2 (),
               this.secondService.GetData3 ()
             );
           }
         })
       ) .subscribe (([first, second]) =&gt; {
         console.log (first); // type FirstType | SecondType
         console.log (second); // type FirstType | ThirdType
       });
  
  
      
  
  }
  </code></pre>
  <p>How I can refactor this part of code for getting first variable with &lt;FirstType | SecondType&gt; interface and second variable with  interface:</p>
  <pre><code>... subscribe (([first, second]) =&gt; {
         console.log (first); // type FirstType | SecondType
         console.log (second); // type ThirdType
       });
  </code></pre>