title: TypeError: Object doesn't support property or method 'map' - AngularJS2
body: <p>I have service file which is returning a subscribable result on some condition(obviously making an http call) and returning a normal object on some other conditions. Since I have used <code>.subscribe</code> in <code>component.ts</code> for calling this service method, getting "TypeError: Object doesn't support property or method 'map'" on condition where http calls are not happening.</p>
  
  <p><code>component.ts</code> file code </p>
  
  <pre><code>    this.myservice.userAuthenticate( 'user' ).subscribe(result =&gt; {
  
          console.log('results', result);
      });
  </code></pre>
  
  <p>and my service file is like this</p>
  
  <pre><code>    public userAuthenticate(user ): Observable&lt;any&gt; {
  
      const expired = this.expiry.hasExpired();
      if ( expired ) 
  
              return this.userService.generateUserId('some input' ).map( data =&gt; {
                  this.CheckUser( User);
                  return &lt;any&gt;userInfo;
              } );
          }
      } else {
  
          return this.CheckUser( User).map( response =&gt; {
              return &lt;any&gt;userInfo;
          } );
      }
  </code></pre>
  
  <p>In the else part, the Im just getting data from storage and processing it using <code>CheckUser</code>  method. There is no http calls are happening and it is giving me the above error. Is there any way I can return a subscribable result even without a http calls ?</p>
  
  <p>One work around is to have this check from component file and only subscribe for first part, but I have to make the same changes in lot of places as this particular method in many places. Could anyone please let me know how can I give a subscribable response in else condition ?</p>