Skip to content

Commit 8f68f77

Browse files
authored
fix(typings): allow port to be a number (#680)
`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
1 parent 68dc241 commit 8f68f77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/socket.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface SocketOptions {
2727
/**
2828
* The port for our connection. Set from the URI passed when connecting
2929
*/
30-
port: string;
30+
port: string | number;
3131

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

259259
static priorWebsocketSuccess: boolean;

0 commit comments

Comments
 (0)