fix typescript definitions
See original GitHub issuev.3.0.3
- SocketIO client options
What happen with old one SocketIOClientOptions?
At this moment works only:
import io, { ManagerOptions } from 'socket.io-client;
const IOOptions: Partial<ManagerOptions> = {
path: '/seacher',
autoConnect: false,
transports: ['websocket'],
};
Write Partial<ManagerOptions>
is not good way.
- Type of
io
now unknown
If write
import io from 'socket.io-client';
...
this._socket = io(url, IOOptions);
There are will be an TS error for io
like
import io
This expression is not callable.
Type 'typeof import("/mnt/hdd/Projects/home/searcher/node_modules/socket.io-client/build/index")' has no call signatures.ts(2349)
Works only ‘classic’ way:
import io from 'socket.io-client';
...
this._socket = (io as any)(url, IOOptions);
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Documentation - Type Declarations - TypeScript
TypeScript automatically finds type definitions under node_modules/@types , so there's no other step needed to get these types available in your program.
Read more >How to overwrite incorrect TypeScript type definition installed ...
In order to do this: npm remove @types/dotenv . Create a folder types on your project. Copy the whole folder dotenv found in...
Read more >Surviving the TypeScript Ecosystem — Part 4 - Medium
The solution is to make a type definition file. A type definition file is a file that ends in “.d.ts”. It is a...
Read more >The repository for high quality TypeScript type definitions.
The repository for high quality TypeScript type definitions. ... To fix the errors, add a package.json with "dependencies": { "<libraryName>": "x.y.z" } ....
Read more >TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
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
change to
and must (importance) update your server to socket.io 3.0.3, it take all day of my T_T
Those documentation links worked for me, thank a lot! @darrachequesne