I've used Leaflet 0.7 extensively, but am trying 1.7 for a new project for the first time. I'm trying to extend the GeoJSON layer class to use a default pointToLayer
method, these appears to fail because the type definition for GeoJSON isn't being associated with the object... Here's what I'm trying:
import { GeoJSON } from 'leaflet';
const geojsonMarkerOptions = {
...
};
export const Layer = GeoJSON.extend({
initialize: function() {
GeoJSON.prototype.initialize.call(this, [], {
pointToLayer: (feature, latlng) => this.pointToLayer(feature, latlng)
});
},
pointToLayer: function(feature, latlng) {
...
}
}
And the compiler complains:
Property 'initialize' does not exist on type 'GeoJSON'
So somehow the GeoJSON type isn't being associated with the GeoJSON object is my interpretation of this... What's yours?? I'm using Leaflet 1.7.1, @types/leaflet 1.5.19, and Typescript 4.0.3. I've updated to Angular 10 and removed and re-installed both Leaflet and its @types package, and I've also tried clearing out my node modules and re-installing them. Somebody knows what I'm doing wrong here, right??