question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript error TS1005 when building with version 4.1.1

See original GitHub issue

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: https://github.com/socketio/socket.io/commit/b84ed1e41c9053792caf58974c5de9395bfd509f#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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
MaximeKjaercommented, May 13, 2021

What version of TypeScript are you using?

I suspect that this issue could be caused by the usage of labeled tuple types in the commit you referenced. This is a new feature in TypeScript 4.0, which I think might be causing trouble if you are using older versions.

7reactions
darrachequesnecommented, May 17, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error compiling TypeScript sources getting TS1005
Im just guessing but I see that you are using an old version of gulp-typescript . Would u mind trying with a newer...
Read more >
Error - [tsc] node_modules/@fluentui/react/lib/components ...
types.d.ts(13,35): error TS1005: ';' expected. I am trying to develop this SPFX inside our SharePoint online site @ https ...
Read more >
ts2349: this expression is not callable. type 'never' has no call ...
I am getting this error when I am calling the process-method from another component: TS2349: This expression is not callable. Type 'never' has...
Read more >
mongodb d ts error ts1005: ';' expected - Sell iPad 3 NYC
Once the build is start running I got the same issue, I did updated the typescript to version ^4.7.1 still facing the issue,...
Read more >
node modules rxjs internal types d ts 81 44 error TS1005 ...
Due to the existence of a version mismatch, such a problem could arise which ... TypeScript for First Build error rxjs inside node_modules....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found