Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type inconsistencies with query option #679

Closed
kaangokdemir opened this issue Oct 29, 2021 · 3 comments
Closed

Type inconsistencies with query option #679

kaangokdemir opened this issue Oct 29, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@kaangokdemir
Copy link
Contributor

Describe the bug
According to Socket IO's documentation, query option could be a number as well and with JavaScript, it works as it expected. However there are Type errors with Typescript

To Reproduce

Client

// my-file.ts (Example from docs)
import { io } from "socket.io-client";

const socket = io({
  query: {
    x: 42
  }
});

Expected behavior
No Type errors.

Received Errror

No overload matches this call.
  Overload 1 of 3, '(uri: string, opts?: Partial<ManagerOptions & SocketOptions>): Socket<DefaultEventsMap, DefaultEventsMap>', gave the following error.
    Type 'number' is not assignable to type 'string'.
  Overload 2 of 3, '(uri: string | Partial<ManagerOptions & SocketOptions>, opts?: Partial<ManagerOptions & SocketOptions>): Socket<...>', gave the following error.
    Type 'number' is not assignable to type 'string'.ts(2769)
@kaangokdemir kaangokdemir added the bug Something isn't working label Oct 29, 2021
@darrachequesne
Copy link
Member

You are right, the type of query is a bit too strict 👍 Would you time to open a pull request?

@kaangokdemir
Copy link
Contributor Author

I'll give a hand on it @darrachequesne

@darrachequesne
Copy link
Member

This should be fixed by 018e1af, included in [email protected]. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants