I’m trying to pass a parameter to a decorator that references it’s own class:
export class SomeClass {
public async handleError(error: Error): Promise<void> {
// ... treating errors
}
@treat(SomeClass.prototype.handleError) // <- error here
public async doSomething(): Promise<void> {
// ... doing something
}
}
But I’m getting this error:
ReferenceError: Cannot access 'SomeClass' before initialization
Is there anyway to do that or will I have to send the name of the treating function and find it inside the decorator?