title: returning an Observable or a number from a function and how to test it
body: <p>I have a function which should either return an <code>Observable</code> or <code>-1</code> if the argument is incorrect. </p>
  
  <pre><code>public getX(x:...): Observable|number {
      switch(x) {
        case 3:
          return Observable..
          break;
        default:
          return -1;
  
      }
  }
  </code></pre>
  
  <p>What is the way to check that the function call returned an <code>Observable</code> or <code>-1</code>? </p>
  
  <pre><code>y = getX(..)
  
  if(y === -1) //would this work if `getX` actually returns an `Observable`?
  </code></pre>