Skip to content

TypeScript error TS1005 when building with version 4.1.1 #3916

Closed
@LieutenantCrunch

Description

@LieutenantCrunch

Describe the bug
I updated to version 4.1.1 from version 4.0.2 today and when I try to build, I get two errors:

node_modules/socket.io/dist/namespace.d.ts:131:39 - error TS1005: ',' expected.
131     _onServerSideEmit(args: [eventName: string, ...args: any[]]): void;
                                          ~
node_modules/socket.io/dist/namespace.d.ts:131:56 - error TS1005: ',' expected.
131     _onServerSideEmit(args: [eventName: string, ...args: any[]]): void;
                                                           ~

I'm using the following non-default options in my tsconfig:

{
    "target": "esnext",
    "module": "commonjs",
    "sourceMap": true,
    "strict": true,
    "strictPropertyInitialization": false,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
}

I suspect this is due to the following change from yesterday:
b84ed1e#diff-f11671c8d5a031c5560b560c3fc390bf7509925c4914ec4d60011b3d10420c28

To Reproduce

Socket.IO server version: 4.1.1

Server

import * as http from 'http';
import express from 'express';
import * as SocketIO from 'socket.io';

const app: express.Application = express();
const server: http.Server = http.createServer(app);
const io = new SocketIO.Server();

io.attach(server, { cookie: false });

// Additional Express setup omitted

io.on('connection', (socket: SocketIO.Socket) => {
    console.log(`connect ${socket.id}`);

    socket.on('disconnect', () => {
        console.log(`disconnect ${socket.id}`);
    });
});

server.listen(3000, () => {
    console.log(`Listening on port 3000`);
});

Platform:

  • OS: Windows 7 x64
  • Node.JS 14.16.0
  • Express 4.17.1
  • I do not have @types/socket.io installed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions