-
Hello, Still learning how to use this excellent lib in a right way. Just got a question on Clusters example (https://svelte-maplibre.vercel.app/examples/custom_marker_clusters) const { map, source } = mapContext();
export let feature: Feature | undefined;
let innerFeatures: Feature[] = [];
$: if ($map && $source && feature) {
$map
?.getSource($source)
?.getClusterLeaves(feature.properties.cluster_id, 10000, 0)
.then((features) => {
innerFeatures = features;
});
} Typescript is not happy with To get rid of Typescript errors getSource() needs to be casted as GeoJSONSource, but this class is not exported by the lib. Is this the something which is possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That type actually comes straight from the I had considered re-exporting all the types from this library but felt it might muddy things, making it hard to figure out what was added by svelte-maplibre and what was in the original maplibre-gl library that this wraps. |
Beta Was this translation helpful? Give feedback.
That type actually comes straight from the
maplibre-gl
library, so your best bet is probably to import it from there.I had considered re-exporting all the types from this library but felt it might muddy things, making it hard to figure out what was added by svelte-maplibre and what was in the original maplibre-gl library that this wraps.