Skip to content

No type definitions for objectMode? #168

@binarykitchen

Description

@binarykitchen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions