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

Using moleculer-web as mixin creates type error

Open Kombustor opened this issue 4 years ago • 1 comments

I followed the exact tutorial in the Moleculer documentation, this is the code:

import moleculer from 'moleculer';
import ApiGateway from 'moleculer-web';
import { Service } from 'moleculer-decorators';


@Service({
    mixins: [ApiGateway]
})
class ApiService extends moleculer.Service {

    settings = {
        port: process.env.PORT || 8080,
    };
}

export = ApiService;

I'm getting the following error at mixins: [ApiGateway]:

Type 'ServiceSchema<ServiceSettingSchema> & { Errors: ApiGatewayErrors; }' is not assignable to type 'ServiceSchema<ServiceSettingSchema>'.
  Types of property 'dependencies' are incompatible.
    Type 'string | GenericObject | string[] | GenericObject[]' is not assignable to type 'string | ServiceDependency | (string | ServiceDependency)[]'.
      Type 'GenericObject' is not assignable to type 'string | ServiceDependency | (string | ServiceDependency)[]'.
        Type 'GenericObject' is not assignable to type 'string'.

Am I doing anything wrong?

Kombustor avatar Feb 23 '20 21:02 Kombustor

I am unable to reproduce your type error, what typescript version are you using?

ColonelBundy avatar May 24 '20 07:05 ColonelBundy