From ea15603c5bd743b4b6f4b493fc82d4e64b112b4f Mon Sep 17 00:00:00 2001 From: Zac Mullett Date: Mon, 15 Jul 2019 19:01:29 +0200 Subject: [PATCH] [Leaflet] Correct DivIconOptions html type union (#36841) * [Leaflet] correct DivIconOptions.html type union (https://leafletjs.com/reference-1.5.0.html#divicon-html) * Add test for commit 29b2f15 * Replace false option for DivIconOptions.html (https://github.com/DefinitelyTyped/DefinitelyTyped/pull/36841#pullrequestreview-260962388) --- types/leaflet/index.d.ts | 2 +- types/leaflet/leaflet-tests.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index abd91b4982..eadcef4b4b 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -1512,7 +1512,7 @@ export namespace Icon { export function icon(options: IconOptions): Icon; export interface DivIconOptions extends BaseIconOptions { - html?: string | false; + html?: string | HTMLElement | false; bgPos?: PointExpression; iconSize?: PointExpression; iconAnchor?: PointExpression; diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index 429062ac3b..b9c48ebd5e 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -482,7 +482,9 @@ class MyDivIcon extends L.DivIcon { } } -const divIcon = L.divIcon({ html: '' }); +const divIconHtmlAsString = L.divIcon({ html: '' }); +const divIconHtmlAsElement = L.divIcon({ html: htmlElement }); +const divIconHtmlAsFalse = L.divIcon({ html: false }); let defaultIcon = new L.Icon.Default(); defaultIcon = new L.Icon.Default({ imagePath: 'apath' });