Type 'Promise<void>' is not assignable to type 'Marker'. Property '_objectInstance' is missing in type 'Promise<void>'. Ionic 2

I tried to apply what is in the docs gor the google maps in ionic 2 as it is in the official site: Ionic Docs Google Maps

I got this error:

Type 'Promise<void>' is not assignable to type 'Marker'. Property '_objectInstance' is missing in type 'Promise<void>'. Ionic 2

as it is figured in the screenshot below: enter image description here


ANSWERS:


I had this error too, and the solution i've found is to not use marker variable, but only write

map.addMarker(markerOptions).then(...)

And it works, my marker was displayed.


I'm also experiencing this exact issue, using const marker: any = map doesn't fix this error.


try this:

 map.addMarker(markerOptions)
   .then((marker: Marker) => {
     marker.showInfoWindow();
   });

instead of

 const marker: Marker = map.addMarker(markerOptions)
   .then((marker: Marker) => {
     marker.showInfoWindow();
   });


 MORE:


 ? Google Map is not showing on live site using Avada theme
 ? Adding google tiles with R
 ? Chrome navigator.geolocation.getCurrentPosition() error 403
 ? How to move inside google maps only with two fingers?
 ? React Native: Alert message doesn't work when called frequently
 ? React native ToolbarAndroid action icon not working
 ? Android 6.0 Permission Error
 ? Android 6.0 Permission Error
 ? Android 6.0 Permission Error
 ? Android 6.0 Permission Error