let f = function () {
this.aa += 1;
}
class A {
constructor(f) {
this.aa = 1;
f.call(this);
console.log(this.aa);
}
}
new A(f)
how could I write a type definition for f? I want to make f only have this.aa
.
Since there is this
, so I guess using a class for f is more convenient. Maybe extends a base class? But how to write it?
f is defined by the user, so f can't be A's method.