moleculer-decorators icon indicating copy to clipboard operation
moleculer-decorators copied to clipboard

fix issue when using constructor with custom arguments

Open anthrax63 opened this issue 2 years ago • 0 comments

Problem: When i use constructor with some custom arguments like this:

@Service({
    name: 'hello-service',
    constructOverride: false,
})
class HelloService extends moleculer.Service {
    constructor(broker: ServiceBroker, private readonly param1: string, private readonly param2: string) {
        super(broker);
    }

    @Action({
        name: 'say.hello',
    })
    async sayHello() {
        return 'Hello!';
    }
}

any additional parameters are lost because only 2 parameters are passed to the superclass.

anthrax63 avatar May 06 '22 14:05 anthrax63