1
- import React from "react" ;
1
+ import * as React from "react" ;
2
2
3
3
export type BatteryManager = {
4
4
supported : boolean ;
@@ -7,7 +7,7 @@ export type BatteryManager = {
7
7
charging : boolean | null ;
8
8
chargingTime : number | null ;
9
9
dischargingTime : number | null ;
10
- }
10
+ } ;
11
11
12
12
export type GeolocationState = {
13
13
loading : boolean ;
@@ -20,7 +20,7 @@ export type GeolocationState = {
20
20
speed : number | null ;
21
21
timestamp : number | null ;
22
22
error : GeolocationPositionError | null ;
23
- }
23
+ } ;
24
24
25
25
export type HistoryState < T > = {
26
26
state : T ;
@@ -30,22 +30,22 @@ export type HistoryState<T> = {
30
30
clear : ( ) => void ;
31
31
canUndo : boolean ;
32
32
canRedo : boolean ;
33
- }
33
+ } ;
34
34
35
35
export type LongPressOptions = {
36
36
threshold ?: number ;
37
37
onStart ?: ( e : Event ) => void ;
38
38
onFinish ?: ( e : Event ) => void ;
39
39
onCancel ?: ( e : Event ) => void ;
40
- }
40
+ } ;
41
41
42
42
export type LongPressFns = {
43
43
onMouseDown : ( e : React . MouseEvent ) => void ;
44
44
onMouseUp : ( e : React . MouseEvent ) => void ;
45
45
onMouseLeave : ( e : React . MouseEvent ) => void ;
46
46
onTouchStart : ( e : React . TouchEvent ) => void ;
47
47
onTouchEnd : ( e : React . TouchEvent ) => void ;
48
- }
48
+ } ;
49
49
50
50
export type MousePosition = {
51
51
x : number ;
@@ -54,7 +54,7 @@ export type MousePosition = {
54
54
elementY : number ;
55
55
elementPositionX : number ;
56
56
elementPositionY : number ;
57
- }
57
+ } ;
58
58
59
59
export type NetworkState = {
60
60
online : boolean ;
@@ -64,7 +64,7 @@ export type NetworkState = {
64
64
rtt : number | null ;
65
65
saveData : boolean | null ;
66
66
type : string | null ;
67
- }
67
+ } ;
68
68
69
69
export type CustomList < T > = {
70
70
set : ( l : T [ ] ) => void ;
@@ -73,7 +73,7 @@ export type CustomList<T> = {
73
73
insertAt : ( index : number , element : T ) => void ;
74
74
updateAt : ( index : number , element : T ) => void ;
75
75
clear : ( ) => void ;
76
- }
76
+ } ;
77
77
78
78
export type CustomQueue < T > = {
79
79
add : ( element : T ) => void ;
@@ -82,14 +82,14 @@ export type CustomQueue<T> = {
82
82
first : T | undefined ;
83
83
last : T | undefined ;
84
84
size : number ;
85
- }
85
+ } ;
86
86
87
87
export type RenderInfo = {
88
88
name : string ;
89
89
renders : number ;
90
90
sinceLastRender : number ;
91
91
timestamp : number ;
92
- }
92
+ } ;
93
93
94
94
export type SpeechOptions = {
95
95
lang ?: string ;
@@ -100,7 +100,7 @@ export type SpeechOptions = {
100
100
rate ?: number ;
101
101
pitch ?: number ;
102
102
volume ?: number ;
103
- }
103
+ } ;
104
104
105
105
export type SpeechState = {
106
106
isPlaying : boolean ;
@@ -113,13 +113,14 @@ export type SpeechState = {
113
113
rate : number ;
114
114
pitch : number ;
115
115
volume : number ;
116
- }
117
-
118
- declare module '@uidotdev/usehooks' {
116
+ } ;
119
117
118
+ declare module "@uidotdev/usehooks" {
120
119
export function useBattery ( ) : BatteryManager ;
121
120
122
- export function useClickAway < T extends Element > ( cb : ( e : Event ) => void ) : React . MutableRefObject < T > ;
121
+ export function useClickAway < T extends Element > (
122
+ cb : ( e : Event ) => void
123
+ ) : React . MutableRefObject < T > ;
123
124
124
125
export function useCopyToClipboard ( ) : [
125
126
{
@@ -147,7 +148,10 @@ declare module '@uidotdev/usehooks' {
147
148
148
149
export function useDebounce < T > ( value : T , delay : number ) : T ;
149
150
150
- export function useDefault < T > ( initialValue : T , defaultValue : T ) : [ T , React . Dispatch < React . SetStateAction < T > > ] ;
151
+ export function useDefault < T > (
152
+ initialValue : T ,
153
+ defaultValue : T
154
+ ) : [ T , React . Dispatch < React . SetStateAction < T > > ] ;
151
155
152
156
export function useDocumentTitle ( title : string ) : void ;
153
157
@@ -157,14 +161,16 @@ declare module '@uidotdev/usehooks' {
157
161
158
162
export function useHistoryState < T > ( initialPresent ?: T ) : HistoryState < T > ;
159
163
160
- export function useHover < T extends Element > ( ) : [ React . MutableRefObject < T > , boolean ] ;
164
+ export function useHover < T extends Element > ( ) : [
165
+ React . MutableRefObject < T > ,
166
+ boolean
167
+ ] ;
161
168
162
169
export function useIdle ( ms ?: number ) : boolean ;
163
170
164
- export function useIntersectionObserver ( options ?: IntersectionObserverInit ) : [
165
- React . MutableRefObject < Element > ,
166
- IntersectionObserverEntry | null
167
- ] ;
171
+ export function useIntersectionObserver (
172
+ options ?: IntersectionObserverInit
173
+ ) : [ React . MutableRefObject < Element > , IntersectionObserverEntry | null ] ;
168
174
169
175
export function useIsClient ( ) : boolean ;
170
176
@@ -174,9 +180,12 @@ declare module '@uidotdev/usehooks' {
174
180
175
181
export function useLockBodyScroll ( ) : void ;
176
182
177
- export function useLongPress ( callback : ( e : Event ) => void , options ?: LongPressOptions ) : LongPressFns ;
183
+ export function useLongPress (
184
+ callback : ( e : Event ) => void ,
185
+ options ?: LongPressOptions
186
+ ) : LongPressFns ;
178
187
179
- export function useMap < T > ( initialState ?: T ) : Map < T > ;
188
+ export function useMap < T > ( initialState ?: T ) : Map < T , any > ;
180
189
181
190
export function useMeasure < T extends Element > ( ) : [
182
191
React . MutableRefObject < T > ,
@@ -188,7 +197,10 @@ declare module '@uidotdev/usehooks' {
188
197
189
198
export function useMediaQuery ( query : string ) : boolean ;
190
199
191
- export function useMouse < T extends Element > ( ) : [ MousePosition , React . MutableRefObject < T > ] ;
200
+ export function useMouse < T extends Element > ( ) : [
201
+ MousePosition ,
202
+ React . MutableRefObject < T >
203
+ ] ;
192
204
193
205
export function useNetworkState ( ) : NetworkState ;
194
206
@@ -209,17 +221,22 @@ declare module '@uidotdev/usehooks' {
209
221
210
222
export function useRenderInfo ( name ?: string ) : RenderInfo | undefined ;
211
223
212
- export function useScript ( src : string , options ?: {
213
- removeOnUnmount ?: boolean ;
214
- } ) : "idle" | "loading" | "ready" | "error" ;
224
+ export function useScript (
225
+ src : string ,
226
+ options ?: {
227
+ removeOnUnmount ?: boolean ;
228
+ }
229
+ ) : "idle" | "loading" | "ready" | "error" ;
215
230
216
231
export function useSet < T > ( values ?: T [ ] ) : Set < T > ;
217
232
218
233
export function useSpeech ( text : string , options ?: SpeechOptions ) : SpeechState ;
219
234
220
235
export function useThrottle < T > ( value : T , delay : number ) : T ;
221
236
222
- export function useToggle ( initialValue ?: boolean ) : [ boolean , ( newValue ?: boolean ) => void ] ;
237
+ export function useToggle (
238
+ initialValue ?: boolean
239
+ ) : [ boolean , ( newValue ?: boolean ) => void ] ;
223
240
224
241
export function useVisibilityChange ( ) : boolean ;
225
242
0 commit comments