moleculer-decorators
moleculer-decorators copied to clipboard
Using moleculer-web as mixin creates type error
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?
I am unable to reproduce your type error, what typescript version are you using?