Skip to content

Type 'ListenEvents' does not satisfy the constraint 'EventsMap'. node_modules/socket.io/dist/namespace.d.ts #4459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marc-wittwer opened this issue Aug 28, 2022 · 3 comments · Fixed by wixplosives/engine#1415
Labels
bug Something isn't working
Milestone

Comments

@marc-wittwer
Copy link

Describe the bug
I get the following error when I run npm run build in my node.js express application.

 npm run build

> [email protected] build
> tsc -p .

node_modules/socket.io/dist/namespace.d.ts:14:133 - error TS2344: Type 'ListenEvents' does not satisfy the constraint 'EventsMap'.

14 export interface ServerReservedEventsMap<ListenEvents, EmitEvents, ServerSideEvents, SocketData> extends NamespaceReservedEventsMap<ListenEvents, EmitEvents, ServerSideEvents, SocketData> {
                                                                                                                                       ~~~~~~~~~~~~

  node_modules/socket.io/dist/namespace.d.ts:14:42
    14 export interface ServerReservedEventsMap<ListenEvents, EmitEvents, ServerSideEvents, SocketData> extends NamespaceReservedEventsMap<ListenEvents, EmitEvents, ServerSideEvents, SocketData> {
                                                ~~~~~~~~~~~~
    This type parameter might need an `extends EventsMap` constraint.

node_modules/socket.io/dist/namespace.d.ts:15:42 - error TS2344: Type 'ListenEvents' does not satisfy the constraint 'EventsMap'.

15     new_namespace: (namespace: Namespace<ListenEvents, EmitEvents, ServerSideEvents, SocketData>) => void;
                                            ~~~~~~~~~~~~

  node_modules/socket.io/dist/namespace.d.ts:14:42
    14 export interface ServerReservedEventsMap<ListenEvents, EmitEvents, ServerSideEvents, SocketData> extends NamespaceReservedEventsMap<ListenEvents, EmitEvents, ServerSideEvents, SocketData> {
                                                ~~~~~~~~~~~~
    This type parameter might need an `extends EventsMap` constraint.


Found 2 errors in the same file, starting at: node_modules/socket.io/dist/namespace.d.ts:14

My system:
Node v17.9.1 (npm v8.11.0)
Ubuntu 20.04
socket.io: "^4.5.1",

@marc-wittwer marc-wittwer added the to triage Waiting to be triaged by a member of the team label Aug 28, 2022
@marc-wittwer
Copy link
Author

marc-wittwer commented Aug 28, 2022

#4431 or #4445
This might fix it.

AviVahl added a commit to wixplosives/engine that referenced this issue Aug 29, 2022
- add several generic constrains per new ts generics behavior
- disable lib check until socket.io is fixed socketio/socket.io#4459
- regenerate lock file
AviVahl added a commit to wixplosives/engine that referenced this issue Aug 29, 2022
- add several generic constrains per new ts generics behavior
- disable lib check until socket.io is fixed socketio/socket.io#4459
- regenerate lock file
@shhdharmen
Copy link

For time being, I used commonJS pattern of require and it's building fine:

const { Server } = require("socket.io");

@darrachequesne
Copy link
Member

This should be fixed by #4431, included in version 4.5.2.

Thanks for reporting this issue 👍

@darrachequesne darrachequesne added bug Something isn't working and removed to triage Waiting to be triaged by a member of the team labels Sep 4, 2022
@darrachequesne darrachequesne added this to the 4.5.2 milestone Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants