Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during project build #54

Open
sergeyzwezdin opened this issue Jun 8, 2023 · 1 comment
Open

Error during project build #54

sergeyzwezdin opened this issue Jun 8, 2023 · 1 comment

Comments

@sergeyzwezdin
Copy link

I'm trying to register moleculer-io in moleculer using documentation with the following config:

import SocketIOService from 'moleculer-io'
const ioService = broker.createService({
  name: 'io',
   mixins: [SocketIOService],
   settings: {
     serveClient: false,
     io: {
       options: {
         path: '/api/socket.io',
       },
       namespaces: {
         '/': {
           authorization: true,
         },
       },
     },
   },
});

Getting the error on the line mixins: [SocketIOService],:

../src/services/socketio.ts:13:16 - error TS2322: Type 'Partial<IOServiceSchema>' is not assignable to type 'Partial<ServiceSchema<ServiceSettingSchema>>'.
  Types of property 'methods' are incompatible.
    Type '(Partial<IOMethods> & ThisType<IOServiceSchema>) | undefined' is not assignable to type 'ServiceMethods | undefined'.
      Type 'Partial<IOMethods> & ThisType<IOServiceSchema>' is not assignable to type 'ServiceMethods | undefined'.

13       mixins: [SocketIOService],
                  ~~~~~~~~~~~~~~~

I use the following versions of packages:

"moleculer": "0.14.29",
"moleculer-io": "2.2.0",
"moleculer-web": "0.10.5",

What should I pass to mixins to fix typing error?

@theRichu
Copy link

I had the same problem.

I used the following for now, and it works for me.
Hope this helps.

import type { IOSetting } from "moleculer-io";
import SocketIOService from "moleculer-io"
mixins: [ApiGateway, SocketIOService as ServiceSchema<{
  io?: IOSetting;
}>],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants