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

MQTTPubSub is not compatible with PubSubEngine type definitions #8

Open
MichaelHindley opened this issue May 22, 2019 · 3 comments
Open

Comments

@MichaelHindley
Copy link

Trying to use MQTTPubSub with TypeScript results in this compilation error.

image

graphql-mqtt-subscriptions: 1.1.0
typescript: 3.1

@Victordmdb
Copy link

Getting a similar issue but instead with MQTT lib.

  error TS2322: Type 'import("PATH/node_modules/mqtt/types/lib/client").MqttClient' is not assignable to type 'import("PATH/node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client").MqttClient'.
  Types of property 'options' are incompatible.
    Type 'import("PATH/node_modules/mqtt/types/lib/client-options").IClientOptions' is not assignable to type 'import("PATH/node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client-options").IClientOptions'.
      Types of property 'transformWsUrl' are incompatible.
        Type '(url: string, options: import("PATH/node_modules/mqtt/types/lib/client-options").IClientOptions, client: import("PATH/node_modules/mqtt/types/lib/client").MqttClient) => string' is not assignable to type '(url: string, options: import("PATH/node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client-options").IClientOptions, client: import("PATH/node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client").MqttClient) => string'.
          Types of parameters 'client' and 'client' are incompatible.
            Type 'import("PATH/node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client").MqttClient' is not assignable to type 'import("PATH/node_modules/mqtt/types/lib/client").MqttClient'.
              Types of property 'subscribe' are incompatible.
                Type '{ (topic: string | string[], opts: import("PATH/node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client-options").IClientSubscribeOptions, callback?: import("PATH/node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client").ClientSubs...' is not assignable to type '{ (topic: string | string[], opts: import("PATH/node_modules/mqtt/types/lib/client-options").IClientSubscribeOptions, callback?: import("PATH/node_modules/mqtt/types/lib/client").ClientSubscribeCallback): import("PATH/node_modules/mqtt/types/lib...'.
                  Types of parameters 'opts' and 'callback' are incompatible.
                    Property 'qos' is missing in type 'ClientSubscribeCallback' but required in type 'IClientSubscribeOptions'.

21 export default new MQTTPubSub({ client });
                                   ~~~~~~

  node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client-options.d.ts:112:3
    112   qos: QoS
          ~~~
    'qos' is declared here.
  node_modules/graphql-mqtt-subscriptions/node_modules/mqtt/types/lib/client-options.d.ts:126:3
    126   qos: QoS
          ~~~
    'qos' is declared here.
  node_modules/graphql-mqtt-subscriptions/dist/mqtt-pubsub.d.ts:5:5
    5     client?: Client;
          ~~~~~~
    The expected type comes from property 'client' which is declared here on type 'PubSubMQTTOptions'

@wtrocki
Copy link

wtrocki commented Jun 22, 2020

See https://github.com/aerogear/graphql-mqtt-subscriptions

We have that done.

@davidyaha Our team is maintaining the fork of the library. Would you consider merging the changes from our fork or putting note in the repo.

@wtrocki
Copy link

wtrocki commented Jun 22, 2020

Genrally it will be hard to merge due to extensive changes that happened. We tried to pull out whatever was easy to integrate but not all things are possible.

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

No branches or pull requests

4 participants