@@ -5,6 +5,7 @@ import type {
55 Layer ,
66 Path ,
77} from 'leaflet'
8+ import type { PropsWithoutRef } from 'react'
89
910import {
1011 type PropsWithChildren ,
@@ -33,9 +34,9 @@ interface PathWithChildrenProps extends PathProps, PropsWithChildren {}
3334export function createControlComponent <
3435 E extends Control ,
3536 P extends ControlOptions ,
36- > ( createInstance : ( props : P ) => E ) {
37+ > ( createInstance : ( props : PropsWithoutRef < P > ) => E ) {
3738 function createElement (
38- props : P ,
39+ props : PropsWithoutRef < P > ,
3940 context : LeafletContextInterface ,
4041 ) : LeafletElement < E > {
4142 return createElementObject ( createInstance ( props ) , context )
@@ -50,10 +51,14 @@ export function createLayerComponent<
5051 P extends LayerWithChildrenProps ,
5152> (
5253 createElement : (
53- props : P ,
54+ props : PropsWithoutRef < P > ,
5455 context : LeafletContextInterface ,
5556 ) => LeafletElement < E > ,
56- updateElement ?: ( instance : E , props : P , prevProps : P ) => void ,
57+ updateElement ?: (
58+ instance : E ,
59+ props : PropsWithoutRef < P > ,
60+ prevProps : PropsWithoutRef < P > ,
61+ ) => void ,
5762) {
5863 const useElement = createElementHook ( createElement , updateElement )
5964 const useLayer = createLayerHook ( useElement )
@@ -65,10 +70,10 @@ export function createOverlayComponent<
6570 P extends LayerWithChildrenProps ,
6671> (
6772 createElement : (
68- props : P ,
73+ props : PropsWithoutRef < P > ,
6974 context : LeafletContextInterface ,
7075 ) => LeafletElement < E > ,
71- useLifecycle : DivOverlayLifecycleHook < E , P > ,
76+ useLifecycle : DivOverlayLifecycleHook < E , PropsWithoutRef < P > > ,
7277) {
7378 const useElement = createElementHook ( createElement )
7479 const useOverlay = createDivOverlayHook ( useElement , useLifecycle )
@@ -80,10 +85,14 @@ export function createPathComponent<
8085 P extends PathWithChildrenProps ,
8186> (
8287 createElement : (
83- props : P ,
88+ props : PropsWithoutRef < P > ,
8489 context : LeafletContextInterface ,
8590 ) => LeafletElement < E > ,
86- updateElement ?: ( instance : E , props : P , prevProps : P ) => void ,
91+ updateElement ?: (
92+ instance : E ,
93+ props : PropsWithoutRef < P > ,
94+ prevProps : PropsWithoutRef < P > ,
95+ ) => void ,
8796) {
8897 const useElement = createElementHook ( createElement , updateElement )
8998 const usePath = createPathHook ( useElement )
@@ -92,10 +101,14 @@ export function createPathComponent<
92101
93102export function createTileLayerComponent < E extends Layer , P extends LayerProps > (
94103 createElement : (
95- props : P ,
104+ props : PropsWithoutRef < P > ,
96105 context : LeafletContextInterface ,
97106 ) => LeafletElement < E > ,
98- updateElement ?: ( instance : E , props : P , prevProps : P ) => void ,
107+ updateElement ?: (
108+ instance : E ,
109+ props : PropsWithoutRef < P > ,
110+ prevProps : PropsWithoutRef < P > ,
111+ ) => void ,
99112) {
100113 const useElement = createElementHook ( createElement , updateElement )
101114 const useLayer = createLayerHook ( useElement )
0 commit comments