Skip to content

Commit

Permalink
Replace ts-ignore with a simple value check
Browse files Browse the repository at this point in the history
  • Loading branch information
richterb committed Aug 19, 2022
1 parent 96d7281 commit 20727d3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/visualizations/src/components/Map/MapRender.svelte
Expand Up @@ -154,12 +154,13 @@
}
function addTooltip(e: MapLayerMouseEvent) {
// @ts-ignore // Somehow `features` isn't part of the type, but exists in the object at runtime
const description = renderTooltip(e.features[0]);
if (hoverPopup.isOpen()) {
hoverPopup.setLngLat(e.lngLat).setHTML(description);
} else {
hoverPopup.setLngLat(e.lngLat).setHTML(description).addTo(map);
if (e.features) {
const description = renderTooltip(e.features[0]);
if (hoverPopup.isOpen()) {
hoverPopup.setLngLat(e.lngLat).setHTML(description);
} else {
hoverPopup.setLngLat(e.lngLat).setHTML(description).addTo(map);
}
}
}
Expand Down

0 comments on commit 20727d3

Please sign in to comment.