title: TypeScript - wait for an observable/promise to finish, and return observable
body: <p>I am quite new to TypeScript &amp; RxJS, and I am trying to return an <code>Observable</code> after another <code>Observable</code> is finished:</p>
  
  <pre><code>public myObservable = () : Observable&lt;boolean&gt; =&gt; {
      console.log('retrieving the token in DB');
      return Observable.create(observer =&gt; {
          setTimeout(() =&gt; {
              observer.next(true);
              observer.complete();
          }, 5000);
      });
  }
  
  public makeRequest = (): Observable&lt;any&gt; =&gt; {
      return this.myObservable().subscribe(
          function (x) {
              console.log('I have the token, now I can make the HTTP call');
  
              return this.http.get('http://jsonplaceholder.typicode.com/posts/1')
                  .map( (responseData) =&gt; {
                      return responseData.json();
                  })
                  .map((item:any) =&gt; {
                      return {
                          id: item.id,
                          userId: item.userId,
                          title: item.title,
                          body: item.body
                      };
                  });
  
          },
          function (err) {
              console.error('Error: ' + err);
          },
          function () {
              console.log('Completed');
          });
  
  }
  </code></pre>
  
  <p>I received this error: "Returned expression type subscription is not assignable to type <code>Observable&lt;any&gt;</code>".</p>
  
  <p>I totally understand the error here <em>(an Observable is like a stream, and a subscription is the fact of "observing" that stream)</em>, but I don't see how to "wait" for an <code>Observable</code> <em>(or a promise)</em> to finish to return a new <code>Observable</code>. How can I do that?</p>