Somehow, the objectMode option has disappeared in the TypeScript definition. I wonder, it is still supported?
Here is my code:
const stream = websocket(ws, {
// Important, send each chunk on its own, see
// https://github.com/maxogden/websocket-stream/issues/117#issuecomment-298826011
objectMode: true,
});
It produces this error
No overload matches this call.
Overload 1 of 2, '(target: string | WebSocket, options?: ClientOptions | undefined): WebSocketDuplex', gave the following error.
Object literal may only specify known properties, and 'objectMode' does not exist in type 'ClientOptions'.
Overload 2 of 2, '(target: string | WebSocket, protocols?: string | string[] | undefined, options?: ClientOptions | undefined): WebSocketDuplex', gave the following error.
Object literal may only specify known properties, and 'objectMode' does not exist in type 'string[]'.
I'm using latest websocket-stream version 5.5.2
There is one interesting I've found out in the type declarations:
declare function WebSocketStream(target: string | WebSocket, options?: WebSocket.ClientOptions): WebSocketStream.WebSocketDuplex;
WebSocket.ClientOptions itself stems from @types/ws where the ClientOptions are being extended by SecureContextOptions which comes from @types/node. To me, it seems there are some version mismatches, perhaps?
For now, I will @tsignore it, but am not comfortable about it.
Advice, discussions welcome. Thanks.
Somehow, the
objectModeoption has disappeared in the TypeScript definition. I wonder, it is still supported?Here is my code:
It produces this error
I'm using latest websocket-stream version
5.5.2There is one interesting I've found out in the type declarations:
WebSocket.ClientOptionsitself stems from@types/wswhere theClientOptionsare being extended bySecureContextOptionswhich comes from@types/node. To me, it seems there are some version mismatches, perhaps?For now, I will
@tsignoreit, but am not comfortable about it.Advice, discussions welcome. Thanks.