Hi,
When trying to use the CachedTileLayer by:
const cachedTile = new CachedTileLayer(`https://api.mapbox.com/styles/v1/jb-alphero/cjitgxwys4ab62rmdov2oqku9/tiles/256/{z}/{x}/{y}?access_token=${ACCESS_TOKEN}`, {
attribution: 'Test',
maxZoom: 18,
// id: 'mapbox.streets',
// accessToken: { ACCESS_TOKEN },
}).addTo(leafletMap);
And:
const cachedTile = new CachedTileLayer(`https://api.mapbox.com/styles/v1/jb-alphero/cjitgxwys4ab62rmdov2oqku9/tiles/256/{z}/{x}/{y}?access_token=${ACCESS_TOKEN}`, {
attribution: 'Test',
maxZoom: 18,
// id: 'mapbox.streets',
// accessToken: { ACCESS_TOKEN },
});
leafletMap.addLayer(cachedTile);
I'm getting this error:
Argument of type 'CachedTileLayer' is not assignable to parameter of type 'Layer'.
Types of property 'addTo' are incompatible.
Type '(map: Map | LayerGroup<any>) => CachedTileLayer' is not assignable to type '(map: Map | LayerGroup<any>) => Layer'.
Types of parameters 'map' and 'map' are incompatible.
Type 'L.Map | L.LayerGroup<any>' is not assignable to type 'import("/Users/martin/Desktop/projects/metservice-consumer-web/node_modules/@yaga/leaflet-cached-...'.
Type 'Map' is not assignable to type 'Map | LayerGroup<any>'.
Type 'Map' is not assignable to type 'LayerGroup<any>'.
Property 'toGeoJSON' is missing in type 'Map'.
I also tried to create a LayerGroup and adding the CachedTileLayer but got the same thing.
I noticed we have different versions of leaflet types (I'm on ^1.2.7), but there does not seem to be a difference in the methods signature.
I'm not sure what I'm doing wrong, but I'm not being capable of getting this to work. I'm sure it must be something really silly, but if you could give me a hand that'd be great.
Thanks.
Cheers!
Hi,
When trying to use the
CachedTileLayerby:And:
I'm getting this error:
I also tried to create a
LayerGroupand adding theCachedTileLayerbut got the same thing.I noticed we have different versions of leaflet types (I'm on
^1.2.7), but there does not seem to be a difference in the methods signature.I'm not sure what I'm doing wrong, but I'm not being capable of getting this to work. I'm sure it must be something really silly, but if you could give me a hand that'd be great.
Thanks.
Cheers!