title: rxjs: returning value with pipe(map)
body: <p>How to return value when using pipe and map, like in this scenario:</p>
  
  <pre><code>return this.service.someEvent().pipe(
    map(x =&gt; {
      return this.service.someValue;
    })
  )
  </code></pre>
  
  <p>but the value is never returned since never subscrubed to the event, if i use it like this:</p>
  
  <pre><code>const a = this.service.someEvent().pipe(
    map(x =&gt; {
      return this.service.someValue;
    })
  )
  
  return a.subscribe();
  </code></pre>
  
  <p>i get an error (i know this is wrong).</p>
  
  <pre><code>TS2322: Type 'Subscription' is not assignable to type 'boolean | Observable&lt;boolean&gt; | Promise&lt;boolean&gt;'.   Type 'Subscription' is not assignable to type 'Promise&lt;boolean&gt;'.     Property 'then' is missing in type 'Subscription'.
  </code></pre>
  
  <p>So i need i way to return the value.</p>
  
  <p>UPDATE: 
  the better description (i need to duplicate this code with the latest version of rxjs):</p>
  
  <pre><code>canActivate(next: ActivatedRouteSnapshot,
                 state: RouterStateSnapshot): Observable&lt;boolean&gt; | Promise&lt;boolean&gt; | boolean {
    return this.service.something().map(x =&gt; {
      if (x) {
        return true;
      } else {
        return false;
      }
    })
  </code></pre>
  
  <p>}</p>
  
  <p>need to do it with map inside pipe (as i understood).</p>