diff --git a/folium/map.py b/folium/map.py index 3c5302b8a..758e64153 100644 --- a/folium/map.py +++ b/folium/map.py @@ -5,7 +5,7 @@ import warnings from collections import OrderedDict -from typing import List, Optional, Sequence, Union +from typing import TYPE_CHECKING, List, Optional, Sequence, Union from branca.element import Element, Figure, Html, MacroElement @@ -21,6 +21,9 @@ validate_location, ) +if TYPE_CHECKING: + from folium.features import CustomIcon, DivIcon + class Evented(MacroElement): """The base class for Layer and Map @@ -373,7 +376,7 @@ def __init__( location: Optional[Sequence[float]] = None, popup: Union["Popup", str, None] = None, tooltip: Union["Tooltip", str, None] = None, - icon: Optional[Icon] = None, + icon: Optional[Union[Icon, "CustomIcon", "DivIcon"]] = None, draggable: bool = False, **kwargs: TypeJsonValue, ):