Capacitor/google-maps LatLngBounds Error: Can’t resolve ‘@capacitor/google-maps/dist/typings/definitions’

So i’m using typescript and “@capacitor/google-maps”: “^5.4.1”.
I’m trying to use map.fitBounds, I’m doing as follows:

import { LatLngBounds, LatLngBoundsInterface } from '@capacitor/google-maps/dist/typings/definitions';

async setFitBounds() {
    let latLng = { lat: -15.811394, lng: -47.924856} // Somewhere in brasil

    let latLngBounds: LatLngBoundsInterface = {
      southwest: latLng,
      center: latLng,
      northeast: latLng,
    };

    let bounds = new LatLngBounds(latLngBounds); // Error!!!!
    
    // await this.map?.fitBounds(bounds, 20); // I comment this, because is not the Error
  }
  • Error: Module not found: Error: Can’t resolve ‘@capacitor/google-maps/dist/typings/definitions’ in ‘File’

I already change the coordenates, and put differents like:

let center = {lat:-15.802805, lng:-47.909740}
let southwest = {lat:-15.786452, lng:-47.910427}
let northeast = {lat:-15.814734, lng:-47.906645}

Same error.

Help please!

You have to import from '@capacitor/google-maps', not from '@capacitor/google-maps/dist/typings/definitions'

2 Likes