No type definitions for objectMode?
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- node.js, typescript
- Domain
- developer-experience
Research direction
Start with the WebSocketStream declaration shown in the issue and trace the ClientOptions type through @types/ws and @types/node. Confirm whether objectMode is supported, then make the declaration accept it and verify that the provided TypeScript example type-checks without an ignore directive.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- JavaScript
- Stars
- 667
- Forks
- 110
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from max-mapper/websocket-stream
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
max-mapper/websocket-stream#165 · 1 comment · 2 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
max-mapper/websocket-stream#164 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
max-mapper/websocket-stream#163 · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
max-mapper/websocket-stream#162 · 2 comments · 1 reaction ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 45/100
max-mapper/websocket-stream#161 · 1 comment · 3 reactions ·
All issues in max-mapper/websocket-stream
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·
-
client-controller-update ta-bot-triage team-money-movement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MetaMask/metamask-mobile#36594 ·