Subscriptions-transport-ws: Typing error in server.d.ts file

Created on 6 Oct 2017  路  8Comments  路  Source: apollographql/subscriptions-transport-ws

Package verion: "subscriptions-transport-ws": "^0.8.3"

I have an issue compiling my project from Typescript to Javascript because of a wrong definition in this package, this is the error:

62     static create(options: ServerOptions, socketOptions: WebSocket.IServerOptions): SubscriptionServer;
                                                                      ~~~~~~~~~~~~~~

node_modules/subscriptions-transport-ws/dist/server.d.ts(62,68): error TS2694: Namespace 'WebSocket' has no exported member 'IServerOptions'.


63     constructor(options: ServerOptions, socketOptions: WebSocket.IServerOptions);
                                                                    ~~~~~~~~~~~~~~

node_modules/subscriptions-transport-ws/dist/server.d.ts(63,66): error TS2694: Namespace 'WebSocket' has no exported member 'IServerOptions'.

After verification I found it's true that the Websocket object (follows the definition of @types/ws) has no exported member IServerOptions.

waiting-for-response

Most helpful comment

Hi, can this be patched for 0.8.x? We are still using Apollo Client 1.x and addGraphQLSubscriptions.

All 8 comments

@ibraback can u check if the new 0.9.1 version fixes this?

@mistic it fixed it thanks 馃帀

Thank you for the report and fix confirmation.

Hi, can this be patched for 0.8.x? We are still using Apollo Client 1.x and addGraphQLSubscriptions.

This is happening to me @ 0.9.4 using Apollo client 1.x

@donedgardo Check your yarn.lock or npm lock file. In my case, it turned out that other dependency forced usage of older version of subscriptions-transport-ws after all, that depended on older @types/ws, which doesn't have IServerOptions type.

I solved it by explicitly setting the version of "@types/ws" to "3.0.0" (not "^3.0.0")...one of the minor releases seems to have broken the compatibility.

Was this page helpful?
0 / 5 - 0 ratings