Skip to content

Commit 42602d6

Browse files
committed
refactor: no type casting
there is a type predicate already, so we can keep things consistent
1 parent e0482a4 commit 42602d6

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/components/advanced-marker.tsx

Lines changed: 3 additions & 2 deletions
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)