TypeScript error TS1005 when building with version 4.1.1
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
This should be fixed by https://github.com/socketio/socket.io/commit/0cb6ac95b49a27483b6f1b6402fa54b35f82e36f, included in
socket.io@4.1.2
.