diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index de463ae997..7f57c1dfd9 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -1466,7 +1466,7 @@ declare namespace L { export function divIcon(options?: DivIconOptions): DivIcon; export interface MarkerOptions extends InteractiveLayerOptions { - icon?: Icon; + icon?: Icon | DivIcon; clickable?: boolean; draggable?: boolean; keyboard?: boolean; @@ -1483,7 +1483,7 @@ declare namespace L { getLatLng(): LatLng; setLatLng(latlng: LatLngExpression): this; setZIndexOffset(offset: number): this; - setIcon(icon: Icon): this; + setIcon(icon: Icon | DivIcon): this; setOpacity(opacity: number): this; getElement(): HTMLElement; diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index cce5565851..dcdba8a6e8 100644 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -448,6 +448,17 @@ L.marker([1, 2], { }) }).bindPopup('

Hi

'); +L.marker([1, 2], { + icon: L.divIcon({ + className: 'my-icon-class' + }) +}).setIcon(L.icon({ + iconUrl: 'my-icon.png' +})).setIcon(L.divIcon({ + className: 'my-div-icon' +}));; + + L.Util.extend({}); L.Util.create({}); L.Util.bind(() => {}, {}); @@ -466,3 +477,4 @@ L.Util.indexOf([], {}); L.Util.requestAnimFrame(() => {}); L.Util.cancelAnimFrame(1); L.Util.emptyImageUrl; +