socketio/engine.io-client

Type inconsistencies with query option

kaangokdemir opened this issue · 3 comments

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)

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

I'll give a hand on it @darrachequesne

This should be fixed by 018e1af, included in engine.io-client@6.1.0. Thanks!