Here is the property and method
private errorMessages = new Map<string, () => string>(); public get errors(): Array<string> { if (!this.control) { return []; } const { errors } = this.control; return Object.keys(errors).map(key => this.errorMessages.has(key) ? this.errorMessages.get(key)() : <string>errors[key] || key); }
I get this error on this on this part of the code
this.errorMessages.get(key)()
Can someone explain why the problem as to why I'm getting this error and a possible solution to the problem?