" is not assigned to the type "Marker". The property '_objectInstance' is missing in the type 'Promise '. Ionic 2 I t...">

The type "Promise <void>" is not assigned to the type "Marker". The property '_objectInstance' is missing in the type 'Promise <void>'. Ionic 2

I tried to apply what is in google maps documents in ionic 2, as it is done on the official website: 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 shown in the screenshot below: enter image description here

+5
source share
2 answers

I also had this error, and the solution I found was not to use a marker variable, but only write

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

And it works, my marker was displayed.

+3
source

try the following:

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

instead

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

Source: https://habr.com/ru/post/1266217/


All Articles