I have the following code(server):
import express from "express";
import socketio from "socket.io";
import http from "http";
const app = express();
const server = http.createServer(app);
const io = socketio(server);
server.listen(process.env.port || 3000, () => {
console.log(`App running on port ${process.env.port || 3000}`);
});
But i get an error on const io = socketio(server);, It states:
This expression is not callable. Type 'typeof import("SOME_PATH/node_modules/socket.io/dist/index")' has no call signatures
What exactly is the problem here?
package.json:
"devDependencies": {
"@types/express": "^4.17.11",
"@types/node": "^14.14.27",
"@types/socket.io": "^2.1.13",
"nodemon": "^2.0.7",
"ts-node": "^9.1.1"
},
"dependencies": {
"express": "^4.17.1",
"socket.io": "^3.1.1",
"typescript": "^4.1.5"
}