Skip to content

Commit f2db7a8

Browse files
authored
refactor: no type casting (#754)
there is a type predicate already, so we can keep things consistent
1 parent 5dba3fd commit f2db7a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/advanced-marker.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,10 @@ function useAdvancedMarker(props: AdvancedMarkerProps) {
221221
// we set the className directly on the marker.content element that comes
222222
// with the AdvancedMarker.
223223
useEffect(() => {
224-
if (!marker || !marker.content || numChildren > 0) return;
224+
if (!marker?.content || !isElementNode(marker.content) || numChildren > 0)
225+
return;
225226

226-
(marker.content as HTMLElement).className = className || '';
227+
marker.content.className = className ?? '';
227228
}, [marker, className, numChildren]);
228229

229230
// copy other props

0 commit comments

Comments
 (0)