Compiler Error-
Class 'MessageBus' incorrectly implements interface 'IMessageBus'. Property 'dispatch' is missing in type 'MessageBus'.
IMessageBus Interface-
export interface IMessageBus {
dispatch: (eventName: string, info?: any) => void;
listen: (eventName: string, callback: Function) => void;
}
MessageBus Class-
import {IMessageBus} from './IMessageBus';
export class MessageBus implements IMessageBus {
static listeners: Object[] = [];
public static dispatch(event: string, info?: any): void {
this.listeners
.forEach((l) => {
if (l["event"] === event) {
l["cb"](info);
}
});
}
public static listen(event:string, cb: (any) => any):void {
this.listeners.push({event: event, cb: cb});
}
}
Please advice on how to resolve this.