I have a constructor in a class which has certain arguments now i want to introduce a new service which should get intialized everywhere but doing it manually would be a hard task how do i do this intialization of new argument.
export class ResponseError {
constructor(infoMessage: string, data?: any, errCode?: number) {
this.success = false;
this.message = infoMessage;
this.data = data;
this.errCode = errCode;
Logger.warn(
`${new Date().toString()
} - [Response]: ${
infoMessage
}${data ? ` - ${ JSON.stringify(data)}` : ''}`,
);
}
}
Now i want to have a service intialized in it as well like:
constructor(i18n: I18nService, infoMessage: string, data?: any, errCode?: number) {
//...
}
How do i do this?? How do i initalize i18nService so that i do not have to manually write it everywhere.