Skip to content

fix(engine.io): add @types/ws as a dependency#5458

Closed
Not-Sarthak wants to merge 2 commits intosocketio:mainfrom
Not-Sarthak:fix/engine-io-add-types-ws
Closed

fix(engine.io): add @types/ws as a dependency#5458
Not-Sarthak wants to merge 2 commits intosocketio:mainfrom
Not-Sarthak:fix/engine-io-add-types-ws

Conversation

@Not-Sarthak
Copy link
Contributor

Summary

Fixes #5437

Since engine.io@6.6.5 (commit be13cca), the generated .d.ts files import types from "ws" (WebSocket, PerMessageDeflateOptions), but @types/ws was not declared as a dependency. This causes TypeScript compilation errors for consumers who do not have @types/ws installed:

node_modules/engine.io/build/server.d.ts(3,47): error TS7016: Could not find a declaration file for module 'ws'.
node_modules/engine.io/build/transport.d.ts(6,32): error TS7016: Could not find a declaration file for module 'ws'.
node_modules/engine.io/build/transports/websocket.d.ts(3,47): error TS7016: Could not find a declaration file for module 'ws'.

The fix adds @types/ws as a dependency, following the existing pattern where @types/cors and @types/node are already listed as dependencies.

Test plan

  • engine.io tests pass (189/189, both default and compat-v3)
  • Single-line change to package.json — no code changes

… throws

Remove the `return` in the catch block of ClusterAdapter.broadcast() so
that super.broadcast() is still called when remote publishing fails.
This ensures local sockets receive the event even if the cluster publish
errors out (e.g. due to a serialization error in the adapter layer).

Fixes socketio#5456
Since engine.io@6.6.5, the generated .d.ts files import types from "ws"
(WebSocket, PerMessageDeflateOptions), but @types/ws was not declared as
a dependency. This causes TypeScript compilation errors for consumers
who do not have @types/ws installed.

This follows the existing pattern where @types/cors and @types/node are
already listed as dependencies.

Fixes socketio#5437
darrachequesne pushed a commit that referenced this pull request Mar 4, 2026
Since engine.io@6.6.5, the generated .d.ts files import types from "ws"
(WebSocket, PerMessageDeflateOptions), but @types/ws was not declared as
a dependency. This causes TypeScript compilation errors for consumers
who do not have @types/ws installed.

This follows the existing pattern where @types/cors and @types/node are
already listed as dependencies.

Related: #5437
@darrachequesne
Copy link
Member

Merged as 07cbe15. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could not find a declaration file for module 'ws'

2 participants