The error says
Supplied parameter do not match any signature of call target
. When I replace Function
with any
as the second parameter's type, the error disappears. But any
is the same as no type, isn't there a suitable type for functions as parameters?
Instead of Function
(or any
) you can use the following type for your callback
parameter:
(ev: Event)=> any
This matches the type expected by addEventListener
.
Here is the full function signature:
on(eventName: string, callback: (ev: Event)=> any, useCapture: boolean) : Dom.Element {
//...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.