Skip to content

Commit

Permalink
fix(typings): allow port to be a number (#680)
Browse files Browse the repository at this point in the history
`string` is kept for backward compatibility (and `location.port` is a
string).

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Location/port

Related: socketio/socket.io-client#1444
  • Loading branch information
kaangokdemir authored Nov 5, 2021
1 parent 68dc241 commit 8f68f77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface SocketOptions {
/**
* The port for our connection. Set from the URI passed when connecting
*/
port: string;
port: string | number;

/**
* Any query parameters in our uri. Set from the URI passed when connecting
Expand Down Expand Up @@ -253,7 +253,7 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
private readonly opts: Partial<SocketOptions>;
private readonly secure: boolean;
private readonly hostname: string;
private readonly port: string;
private readonly port: string | number;
private readonly transports: string[];

static priorWebsocketSuccess: boolean;
Expand Down

0 comments on commit 8f68f77

Please sign in to comment.