File tree 1 file changed +8
-7
lines changed 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,15 @@ export type InferEvent<TTarget, TType extends string> =
20
20
? Parameters < Extract < TTarget [ `on${TType } `] , AnyFunction > > [ 0 ]
21
21
: Event ;
22
22
23
- export type Listener < TTarget extends EventTarget , TEvent extends Event > =
24
- | { ( this : TTarget , ev : TEvent ) : void }
25
- | ListenerObject < TEvent > ;
26
-
27
- interface ListenerObject < TEvent extends Event > {
28
- // For listener objects, the handleEvent function has the object as the `this` binding
23
+ // For listener objects, the handleEvent function has the object as the `this` binding
24
+ type ListenerObject < TEvent extends Event > = {
29
25
handleEvent ( this : ListenerObject < TEvent > , event : TEvent ) : void ;
30
- }
26
+ } ;
27
+
28
+ // event listeners can be an object or a function
29
+ export type Listener < TTarget extends EventTarget , TEvent extends Event > =
30
+ | ListenerObject < TEvent >
31
+ | { ( this : TTarget , ev : TEvent ) : void } ;
31
32
32
33
export type Binding < TTarget extends EventTarget = EventTarget , TType extends string = string > = {
33
34
type : TType ;
You can’t perform that action at this time.
0 commit comments