title: Ionic2 `service = new google.maps.places.AutocompleteService()` <= cannot find 'google'
body: <blockquote>
  <p>EDIT: adding <code>var google : any;</code> to the global scope of autocomplete.ts did not solve the issue, just deffered it by a bit.</p>
  </blockquote>
  <p>After dealing with this and following several forums for this error and implementing every npm install, both --save-dev to global.</p>
  <p>-I've installed <code>google-maps</code> and <code>@types/googlemaps</code> in the package.json devDependencies', i've also installed the global typeings npm which I later used to install another dt-google.maps file, I've pretty much done everything and it's still showing <code>cannot find 'google'</code>.</p>
  <p>I think it's a package issue, if i'm wrong -correct me.</p>
  <h3>package.json</h3>
  <pre><code>{
    &quot;name&quot;: &quot;githubIonic&quot;,
    &quot;version&quot;: &quot;0.0.1&quot;,
    &quot;author&quot;: &quot;Ionic Framework&quot;,
    &quot;homepage&quot;: &quot;http://ionicframework.com/&quot;,
    &quot;private&quot;: true,
    &quot;scripts&quot;: {
      &quot;clean&quot;: &quot;ionic-app-scripts clean&quot;,
      &quot;build&quot;: &quot;ionic-app-scripts build&quot;,
      &quot;lint&quot;: &quot;ionic-app-scripts lint&quot;,
      &quot;ionic:build&quot;: &quot;ionic-app-scripts build&quot;,
      &quot;ionic:serve&quot;: &quot;ionic-app-scripts serve&quot;
    },
    &quot;dependencies&quot;: {
      &quot;@angular/common&quot;: &quot;4.1.0&quot;,
      &quot;@angular/compiler&quot;: &quot;4.1.0&quot;,
      &quot;@angular/compiler-cli&quot;: &quot;4.1.0&quot;,
      &quot;@angular/core&quot;: &quot;4.1.0&quot;,
      &quot;@angular/forms&quot;: &quot;4.1.0&quot;,
      &quot;@angular/http&quot;: &quot;4.1.0&quot;,
      &quot;@angular/platform-browser&quot;: &quot;4.1.0&quot;,
      &quot;@angular/platform-browser-dynamic&quot;: &quot;4.1.0&quot;,
      &quot;@ionic-native/core&quot;: &quot;3.7.0&quot;,
      &quot;@ionic-native/splash-screen&quot;: &quot;3.7.0&quot;,
      &quot;@ionic-native/status-bar&quot;: &quot;3.7.0&quot;,
      &quot;@ionic/storage&quot;: &quot;2.0.1&quot;,
      &quot;ionic-angular&quot;: &quot;3.2.1&quot;,
      &quot;ionicons&quot;: &quot;3.0.0&quot;,
      &quot;rxjs&quot;: &quot;5.1.1&quot;,
      &quot;sw-toolbox&quot;: &quot;3.6.0&quot;,
      &quot;zone.js&quot;: &quot;0.8.10&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@ionic/app-scripts&quot;: &quot;1.3.7&quot;,
      &quot;@ionic/cli-plugin-ionic-angular&quot;: &quot;1.2.0&quot;,
      &quot;typescript&quot;: &quot;2.2.1&quot;,
      &quot;google-maps&quot;: &quot;^3.2.1&quot;,
      &quot;@types/googlemaps&quot;: &quot;^3.26.11&quot;
  
    },
    &quot;description&quot;: &quot;An Ionic project&quot;
  }
  </code></pre>
  <p>And</p>
  <h3>src/pages/autocomplete/autocomplete.ts</h3>
  <pre><code>import { Component, NgZone } from '@angular/core';
  import { IonicPage, NavController, NavParams } from 'ionic-angular';
  
  import {ViewController} from 'ionic-angular';
  import { GoogleMap, GoogleMapsEvent, GoogleMapsLatLng } from 'ionic-native';
  /**
   * Generated class for the AutocompletePage page.
   *
   * See http://ionicframework.com/docs/components/#navigation for more info
   * on Ionic pages and navigation.
   */
  @IonicPage()
  @Component({
    selector: 'page-autocomplete',
    templateUrl: 'autocomplete.html',
  })
  export class AutocompletePage {
    autocompleteItems;
    autocomplete;
  
    service = new google.maps.places.AutocompleteService();
  
    constructor(public viewCtrl: ViewController, private zone: NgZone, public navCtrl: NavController, public navParams: NavParams) {
      this.autocompleteItems = [];
      this.autocomplete = {
        query: ''
      };
    }
  
    dismiss() {
      this.viewCtrl.dismiss();
    }
    chooseItem(item: any) {
      this.viewCtrl.dismiss(item);
    }
    updateSearch() {
      if (this.autocomplete.query == '') {
        this.autocompleteItems = [];
        return;
      }
      let me = this;
      this.service.getPlacePredictions({
        input: this.autocomplete.query,
        componentRestrictions: {country: 'TH'}
      }, function (predictions, status) {
        me.autocompleteItems = [];
        me.zone.run(function () {
          predictions.forEach(function (prediction) {
            me.autocompleteItems.push(prediction.description);
          });
        });
      });
    }
  
    ionViewDidLoad() {
      console.log('ionViewDidLoad AutocompletePage');
    }
  
  }
  </code></pre>