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.

fix typescript definitions

See original GitHub issue

v.3.0.3

  1. 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.

  1. 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:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
keyyukicommented, Dec 7, 2020

change to

import {io} from 'socket.io-client';

and must (importance) update your server to socket.io 3.0.3, it take all day of my T_T

1reaction
kmirojocommented, Feb 2, 2021

Those documentation links worked for me, thank a lot! @darrachequesne

Read more comments on GitHub >

github_iconTop 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 >

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