Reputation: 337
It says here that I can import it like this:
import io from 'socket.io-client';
But doing this I'm getting an error:
Could not find a declaration file for module 'socket.io-client'. '/.../project/node_modules/socket.io-client/lib/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/socket.io-client` if it exists or add a new declaration (.d.ts) file containing `declare module 'socket.io-client';`ts(7016)
I have tried installing @types/socket.io-client
but the error doesn't go away.
Upvotes: 1
Views: 1702
Reputation: 337
Nevermind, it worked importing this way:
const io = require("socket.io-client/dist/socket.io")
Upvotes: 2