Home > Mobile >  Cannot find name 'ClusterIconStyle' with googlemaps marker clusterer
Cannot find name 'ClusterIconStyle' with googlemaps marker clusterer

Time:06-13

I just update to the following "@types/google.maps": "3.49.2" and I'm using the following "@googlemaps/markerclusterer": "2.0.7".

Doing so I see the following error Cannot find name 'ClusterIconStyle'.

I was using this interface to change the colors of the clusterer icon.

markerClusterIconStyles: ClusterIconStyle[] = [
    {
      textColor: 'white',
      url: 'https://assets.my-folder.com/images/maps/m/m1.png',
      height: 42,
      width: 42,
    },
    {
      textColor: 'white',
      url: 'https://assets.my-folder.com/images/maps/m/m2.png',
      height: 42,
      width: 42,
    }
]
<map-marker-clusterer [zoomOnClick]="true" [gridSize]="20" [styles]="markerClusterIconStyles">
  <!-- My code -->
</map-marker-clusterer>

I looked into the code, but couldn't find any replacement for this interface. Also, textColor doesn't seems to exists anymore.

Did somebody already faced the same error and did find a workaround ?

CodePudding user response:

Make sure that you have (at the top):

import { ClusterIconStyle } from '@angular/google-maps';
  • Related