@@ -5,6 +5,7 @@ import type {
5
5
Layer ,
6
6
Path ,
7
7
} from 'leaflet'
8
+ import type { PropsWithoutRef } from 'react'
8
9
9
10
import {
10
11
type PropsWithChildren ,
@@ -33,9 +34,9 @@ interface PathWithChildrenProps extends PathProps, PropsWithChildren {}
33
34
export function createControlComponent <
34
35
E extends Control ,
35
36
P extends ControlOptions ,
36
- > ( createInstance : ( props : P ) => E ) {
37
+ > ( createInstance : ( props : PropsWithoutRef < P > ) => E ) {
37
38
function createElement (
38
- props : P ,
39
+ props : PropsWithoutRef < P > ,
39
40
context : LeafletContextInterface ,
40
41
) : LeafletElement < E > {
41
42
return createElementObject ( createInstance ( props ) , context )
@@ -50,10 +51,14 @@ export function createLayerComponent<
50
51
P extends LayerWithChildrenProps ,
51
52
> (
52
53
createElement : (
53
- props : P ,
54
+ props : PropsWithoutRef < P > ,
54
55
context : LeafletContextInterface ,
55
56
) => 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 ,
57
62
) {
58
63
const useElement = createElementHook ( createElement , updateElement )
59
64
const useLayer = createLayerHook ( useElement )
@@ -65,10 +70,10 @@ export function createOverlayComponent<
65
70
P extends LayerWithChildrenProps ,
66
71
> (
67
72
createElement : (
68
- props : P ,
73
+ props : PropsWithoutRef < P > ,
69
74
context : LeafletContextInterface ,
70
75
) => LeafletElement < E > ,
71
- useLifecycle : DivOverlayLifecycleHook < E , P > ,
76
+ useLifecycle : DivOverlayLifecycleHook < E , PropsWithoutRef < P > > ,
72
77
) {
73
78
const useElement = createElementHook ( createElement )
74
79
const useOverlay = createDivOverlayHook ( useElement , useLifecycle )
@@ -80,10 +85,14 @@ export function createPathComponent<
80
85
P extends PathWithChildrenProps ,
81
86
> (
82
87
createElement : (
83
- props : P ,
88
+ props : PropsWithoutRef < P > ,
84
89
context : LeafletContextInterface ,
85
90
) => 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 ,
87
96
) {
88
97
const useElement = createElementHook ( createElement , updateElement )
89
98
const usePath = createPathHook ( useElement )
@@ -92,10 +101,14 @@ export function createPathComponent<
92
101
93
102
export function createTileLayerComponent < E extends Layer , P extends LayerProps > (
94
103
createElement : (
95
- props : P ,
104
+ props : PropsWithoutRef < P > ,
96
105
context : LeafletContextInterface ,
97
106
) => 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 ,
99
112
) {
100
113
const useElement = createElementHook ( createElement , updateElement )
101
114
const useLayer = createLayerHook ( useElement )
0 commit comments