title: Provided 'undefined' where stream was expected
body: <p>I am trying to send chained http requests using Rxjs, but I am getting this error...</p>
  
  <blockquote>
    <p>Error: Uncaught (in promise): TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
    TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.</p>
  </blockquote>
  
  <p>I want to get location object from my API, then I want to get latitude and longitude based on <code>location.address</code>.</p>
  
  <pre><code>declare const require : any;
  
  @Injectable()
  export class GoogleMapLocationResolver implements Resolve&lt;{location: Location, longitude: number, latitude: number }&gt; {
  
  constructor( private locationService: LocationService, 
               private route: ActivatedRoute, 
               private router: Router){}
  
  resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): {location: Location, longitude: number, latitude: number } | Observable&lt;{location: Location, longitude:number, latitude: number }&gt; | Promise&lt;{location: Location, longitude: number, latitude: number }&gt; {
  
      let geocoder = require('geocoder');
  
      return this.locationService.getLocation(route.params['id']).map(
          (response: Response)=&gt; { return response.json() }
      ).mergeMap(location =&gt; geocoder.geocode(location.address, function(err, data){
          let latitude
          let longitude
          if(data.status === 'OK'){
              console.log('Status ok: ')
              console.log(data)
              let results = data.results;
              latitude = results[0].geometry.location.lat;
              longitude = results[0].geometry.location.lng;
              console.log(latitude); // PRINTS CORRECT
              console.log(longitude); // PRINTS CORRECT
          }                  
          return {location, longitude, latitude};
      })).catch(error =&gt; {
          this.router.navigate(['/not-found'])
          return Observable.throw(error);
      })  
    }
  }
  </code></pre>
  
  <p><strong>NOTE:</strong> Whats very weird is that after this error, console prints latitude and longitude correct! ('// PRINTS CORRECT' comment)</p>
  
  <p>EDIT: Yep my mistake, I declared variables in if, but that was not a problem at the end. Posting solution soon.</p>