rxjs-websockets: Argument of type 'QueueingSubject<{}>' is not assignable to parameter of type 'Observable'

With rxjs-websockets 1.1.0, queueing-subject 0.1.1 & typescript 2.4.2 I have the following code:

import Rx from "rxjs/Rx";
import { QueueingSubject } from "queueing-subject";
import websocketConnect, {Connection} from "rxjs-websockets";

const queuingSubject = new QueueingSubject();

// ...

const connection: Connection =  websocketConnect(
    myUrl,
    queuingSubject,
    myWebSocket
);

After upgrading from rxjs 5.4.2 to 5.4.3 I get the following type error in the webSocketConnect call:

error TS2345: Argument of type 'QueueingSubject<{}>' is not assignable to parameter of type 'Observable<any>'.  
Property 'source' is protected but type 'Observable<T>' is not a class derived from 'Observable<T>'.

I cleaned the cache (I’m using yarn), deleted node_modules and reinstalled but still get this error…

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Great! Thanks James

Relying on npm dependency duplication as I had advised isn’t a good idea at all… in a previous package I was told by someone I was handling dependencies wrong and they misinformed me and I never bothered to verify. I’ve taken the time to understand peer dependencies fully now and can see it is the right choice for this project.

Released version 4.0.0 with the fix, sorry for the confusion!

suspicious face

Because this isn’t the only problem I had, and several others seem related to either having multiple versions of something after upgrade, or else transitive dependency resolution confusion.