title: undefined return typescript function using .then()
body: <p>Sorry I had no idea on how to write the title in a better way.</p>
  
  <p>I currently have a typescript file with this function inside:</p>
  
  <pre><code>getCurrentPosition(){
      this.geolocation.getCurrentPosition().then((resp) =&gt; {
          this.lat = Math.random()*10;
          this.lng = resp.coords.longitude;
          return {lat: this.lat, lng: this.lng}
        }).catch((error) =&gt; {
          console.log('Error getting location', error);
        });
      //   return {lat: this.lat, lng: this.lng}
  }
  </code></pre>
  
  <p>if I call getCurrentPosition() I receive back an undefined value.
  If I try to call it a second time after some time it return me a value (which was the one previously calculated)</p>
  
  <p>How can I wait for the response of geolocation before returning any value? </p>
  
  <p>Sorry for the dumb question, but I've spend way to much time on this problem!</p>