I created a decorator factory function that looks like this:
export function CustomDecorator (dummyProp: string) {
return function<T extends {new (...args: any[]): any}> (ctor: T) {
@Injectable()
class MyCustomClass extends ctor {
myProp = dummyProp;
constructor(..._: any[]) {
super(_);
}
}
return MyCustomClass;
}
}
Next, I have a service that I want to make injectable and decorate using the function above:
@Injectable()
@CustomDecorator('helloWorld')
export class MyService {
/* ... */
}
Unfortunately, when I try to use it, I encounter the following error: No provider for MyCustomClass!
Can someone help me figure out how to solve this issue?