I am having troubles while implementing use-supercluster with TypeScript. I am trying to use clusters to differentiate two types of data in a Google Map with something like red clusters vs. green clusters.
I can't find any documentation related to use this library with TypeScript and I am not getting enough information from its types:
So, what is argument P
? I was following the use-supercluster
creator's guide to add clusters but after installing supercluster
types I am getting errors here:
const { clusters } = useSuperCluster({
points,
bounds,
zoom,
options: { radius: 75, maxZoom: 25 }
});
Error 1:
I have tried to create manually a GeoJSONProperty
interface with the following attributes:
interface GeoJSONProperty {
cluster: boolean;
pdId: string;
category: string;
}
Then I have tried to assert points
with PointFeature<GeoJSONProperty>
but I got a different error:
Error 2:
This one I was able to "solve" it with const [bounds, setBounds] = useState(undefined);
. But not sure whether that is a good practice.
So, do you know any documentation related to useSuperCluster + TypeScript or just do you know what am I doing wrong here?