title: Angular2 Cannot find namespace 'google'
body: <p>I am working with <code>angular2-google-maps</code> and latest version of Angular2. I am trying to convert some of the local map component functions into services in their own file <code>maps.service.ts</code>. For example:</p>
  
  <p>map.component.ts</p>
  
  <pre><code>getGeoLocation(lat: number, lng: number) {
  if (navigator.geolocation) {
      let geocoder = new google.maps.Geocoder();
      let latlng = new google.maps.LatLng(lat, lng);
      let request = { latLng: latlng };
      geocoder.geocode(request, (results, status) =&gt; {
        if (status == google.maps.GeocoderStatus.OK) {
          let result = results[0];
          if (result != null) {
            this.fillInputs(result.formatted_address);
          } else {
            alert("No address available!");
          }
        }
      });
  }
  }
  </code></pre>
  
  <p>Into something like: <code>maps.service.ts</code></p>
  
  <pre><code>getGeoLocation(lat: number, lng: number): Observable&lt;google.maps.GeocoderResult[]&gt; {
      let geocoder = new google.maps.Geocoder();
      let latlng = new google.maps.LatLng(lat, lng);
      let request = { latLng: latlng };
      return new Observable((observer: Observer&lt;google.maps.GeocoderResult[]&gt;) =&gt; {
          geocoder.geocode({ request }, (
              (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) =&gt; {
                  if (status == google.maps.GeocoderStatus.OK) {
                      observer.next(results);
                      observer.complete();
                  } else {
                      console.log('Geocoding service failed due to: ' +status);
                      observer.error(status);
                  }
              }
          ));
      });
  }
  </code></pre>
  
  <p>The issue I'm getting is that <code>google</code> variable is not being recognized when I try to use <code>Observer&lt;google.maps.GeocoderResult[]&gt;</code>. I have <code>declare var google: any;</code> outside of the service class as well.</p>
  
  <p>The <code>google</code> variable works in my <code>map.componenet.ts</code> but doesn't get recognized in the <code>maps.service.ts</code>.</p>