File tree Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import { useResolver } from './shared/hooks';
39
39
import { eventProps , isClassName , isFile , isRef } from './shared/propTypes' ;
40
40
41
41
import type { PDFDocumentProxy } from 'pdfjs-dist' ;
42
+ import type { allEvents } from 'make-event-props' ;
42
43
import type {
43
44
ClassName ,
44
45
ExternalLinkRel ,
@@ -73,7 +74,15 @@ type OnSourceError = OnError;
73
74
74
75
type OnSourceSuccess = ( ) => void ;
75
76
76
- type EventProps = ReturnType < typeof makeEventProps > ;
77
+ type AllEvents = ( typeof allEvents ) [ number ] ;
78
+
79
+ type EventHandler = ( event : unknown , ...args : unknown [ ] ) => void ;
80
+
81
+ type Props = Record < string , unknown > & {
82
+ [ K in AllEvents ] ?: EventHandler ;
83
+ } ;
84
+
85
+ type EventProps = ReturnType < typeof makeEventProps < Props , PDFDocumentProxy > > ;
77
86
78
87
type DocumentProps = {
79
88
children ?: React . ReactNode ;
Original file line number Diff line number Diff line change @@ -17,11 +17,20 @@ import { useResolver } from './shared/hooks';
17
17
import { eventProps , isClassName , isPdf , isRef } from './shared/propTypes' ;
18
18
19
19
import type { PDFDocumentProxy } from 'pdfjs-dist' ;
20
+ import type { allEvents } from 'make-event-props' ;
20
21
import type { OnItemClickArgs } from './shared/types' ;
21
22
22
23
type PDFOutline = Awaited < ReturnType < PDFDocumentProxy [ 'getOutline' ] > > ;
23
24
24
- type EventProps = ReturnType < typeof makeEventProps > ;
25
+ type AllEvents = ( typeof allEvents ) [ number ] ;
26
+
27
+ type EventHandler = ( event : unknown , ...args : unknown [ ] ) => void ;
28
+
29
+ type Props = Record < string , unknown > & {
30
+ [ K in AllEvents ] ?: EventHandler ;
31
+ } ;
32
+
33
+ type EventProps = ReturnType < typeof makeEventProps < Props , PDFOutline | null > > ;
25
34
26
35
type OutlineProps = {
27
36
className ?: string ;
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import {
31
31
} from './shared/propTypes' ;
32
32
33
33
import type { PDFDocumentProxy , PDFPageProxy } from 'pdfjs-dist' ;
34
+ import type { allEvents } from 'make-event-props' ;
34
35
import type {
35
36
CustomTextRenderer ,
36
37
NodeOrRenderer ,
@@ -46,12 +47,21 @@ import type {
46
47
OnRenderSuccess ,
47
48
OnRenderTextLayerError ,
48
49
OnRenderTextLayerSuccess ,
50
+ PageCallback ,
49
51
RenderMode ,
50
52
} from './shared/types' ;
51
53
52
54
const defaultScale = 1 ;
53
55
54
- type EventProps = ReturnType < typeof makeEventProps > ;
56
+ type AllEvents = ( typeof allEvents ) [ number ] ;
57
+
58
+ type EventHandler = ( event : unknown , ...args : unknown [ ] ) => void ;
59
+
60
+ type Props = Record < string , unknown > & {
61
+ [ K in AllEvents ] ?: EventHandler ;
62
+ } ;
63
+
64
+ type EventProps = ReturnType < typeof makeEventProps < Props , PageCallback > > ;
55
65
56
66
type PageProps = {
57
67
canvasBackground ?: string ;
You can’t perform that action at this time.
0 commit comments