Looking to solve a technical problem in my code. I have a class that needs to call its superclass using a function passed as an argument. I specifically want to pass a static function from the same class:
export abstract class ChildAdapter extends Adapter{
protected constructor() {
super(ChildAdapter.index);
}
static async index() {...}
However, I'm encountering an ESLint warning: ESLint: Avoid referencing unbound methods which may cause unintentional scoping of this
.(@typescript-eslint/unbound-method).
Considering using an external global function instead, but I prefer to keep all methods encapsulated within the class for organizational purposes. Refactoring the code to remove the function reference from super()
is not an option in this case.
Confused by the ESLint warning regarding the static function, as it doesn't involve any "this" reference. Any suggestions on how to address the concerns raised in the ESLint warning?