diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 8402d8bc9b..a08dcce5ae 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -919,6 +919,12 @@ export class GeoJSON
extends FeatureGroup
{ */ resetStyle(layer: Layer): Layer; + /** + * Same as FeatureGroup's setStyle method, but style-functions are also + * allowed here to set the style according to the feature. + */ + setStyle(style: PathOptions | StyleFunction
): this; + options: GeoJSONOptions
;
}
diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts
index d1375fa83f..5e8a876774 100644
--- a/types/leaflet/leaflet-tests.ts
+++ b/types/leaflet/leaflet-tests.ts
@@ -414,6 +414,14 @@ let nestedTwoCoords = [ [12, 13], [13, 14], [14, 15] ];
const nestedLatLngs: L.LatLng[] = L.GeoJSON.coordsToLatLngs(nestedTwoCoords, 1);
nestedTwoCoords = L.GeoJSON.latLngsToCoords(nestedLatLngs, 1);
+const geojson = new L.GeoJSON();
+const style: L.PathOptions = {
+ className: "string",
+};
+const styler: L.StyleFunction