Skip to content

Commit

Permalink
fix: Fix typings of listener methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayfri committed Aug 21, 2021
1 parent b264a89 commit c9b6bd8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export class Fetcher extends EventEmitter {
this.fetching = false;
}

public on<K extends keyof Events>(event: K, listener: (args: Events[K]) => void) {
return super.on(event, listener);
public on<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void) {
return super.on(event, listener as (...args: any[]) => void);
}

public once<K extends keyof Events>(event: K, listener: (args: Events[K]) => void) {
return super.on(event, listener);
public once<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void) {
return super.on(event, listener as (...args: any[]) => void);
}

public emit<K extends keyof Events>(event: K, ...args: Events[K]) {
Expand All @@ -49,8 +49,8 @@ export class Fetcher extends EventEmitter {
return super.eventNames() as Array<keyof Events>;
}

public off<K extends keyof Events>(event: K, listener: (args: Events[K]) => void) {
return super.off(event, listener);
public off<K extends keyof Events>(event: K, listener: (...args: Events[K]) => void) {
return super.off(event, listener as (...args: any[]) => void);
}

/**
Expand Down

0 comments on commit c9b6bd8

Please sign in to comment.