Closed christher-lenander closed 2 years ago
Hello!
First I want to say awesome lib.
I using typescript and whren I trying to use map ref by doing ref="mapRef".
Linting complains that ready doesn't exist on type never.
const panToAndZoom = (position: LatLng) => { if (mapRef.value?.ready) { mapRef.value.map.panTo(position); mapRef.value.map.setZoom(15); } };
To get it to work I had to to like this.
const panToAndZoom = (position: LatLng) => { const gmap = mapRef.value as InstanceType<typeof GoogleMap> | null; if (gmap?.ready) { gmap.map?.panTo(position); gmap.map?.setZoom(15); } };
Hi @ChristherLenander I don't think there's a way around this. You can probably just declare your ref in a nicer way like this:
const mapRef = ref<InstanceType<typeof GoogleMap>>();
Hello!
First I want to say awesome lib.
I using typescript and whren I trying to use map ref by doing ref="mapRef".
Linting complains that ready doesn't exist on type never.
To get it to work I had to to like this.