So i try to overload this method but TypeScript keeps calling its a duplicate method. What obviously is but i want to overload it.
import {Injectable, EventEmitter} from '@angular/core';
@Injectable()
export class NotificationService extends EventEmitter<any>{
/**
*
*/
constructor() {
super(false);
}
public error(message:string ):void{
this.emit({message: message, type: 'error'});
}
public error(message:string, type:string):void {
this.emit({message: message, type: type});
}
public success(message:string):void{
this.emit({message: message, type: 'success'})
}
}
i tried some other thing to like and it still gave the same error.
import {Injectable, EventEmitter} from '@angular/core';
@Injectable()
export class NotificationService extends EventEmitter<any>{
/**
*
*/
constructor() {
super(false);
}
public error(message:string, type?:string ):void{
this.emit({message: message, type: 'error'});
}
public error(message:string, type:string):void {
this.emit({message: message, type: type});
}
public success(message:string):void{
this.emit({message: message, type: 'success'})
}
}
it needs to emit a http api response code.