-
Notifications
You must be signed in to change notification settings - Fork 92
Closed
Description
Got this error:
TS2322: Type '() => WebSocket' is not assignable to type '() => IStompSocket'.
Call signature return types 'WebSocket' and 'IStompSocket' are incompatible.
The types of 'onmessage' are incompatible between these types.
Type '((this: WebSocket, ev: MessageEvent<any>) => any) | null' is not assignable to type '((ev: IStompSocketMessageEvent) => any) | null | undefined'.
Type '(this: WebSocket, ev: MessageEvent<any>) => any' is not assignable to type '(ev: IStompSocketMessageEvent) => any'.
Types of parameters 'ev' and 'ev' are incompatible.
Type 'IStompSocketMessageEvent' is missing the following properties from type 'MessageEvent<any>': lastEventId, origin, ports, source, and 23 more.
It's really easy to reproduce with code like this:
const stompClient = new Client({ /* ... */ });
stompClient.webSocketFactory = function () {
return new WebSocket(url);
};
This is what I have to do as a workaround:
const stompClient = new Client({ /* ... */ });
stompClient.webSocketFactory = function () {
return new WebSocket(url) as IStompSocket;
};
stompjs 7.0.0
TypeScript 5.7.3
Metadata
Metadata
Assignees
Labels
No labels