Skip to content

Commit

Permalink
fix(typings): update the types of "query", "auth" and "headers"
Browse files Browse the repository at this point in the history
Related: #3770
  • Loading branch information
darrachequesne committed Feb 3, 2021
1 parent 9e8f288 commit 4f2e9a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const dotMapRegex = /\.map/;
type Transport = "polling" | "websocket";
type ParentNspNameMatchFn = (
name: string,
query: object,
auth: { [key: string]: any },
fn: (err: Error | null, success: boolean) => void
) => void;

Expand Down Expand Up @@ -246,7 +246,7 @@ export class Server extends EventEmitter {
*/
_checkNamespace(
name: string,
auth: object,
auth: { [key: string]: any },
fn: (nsp: Namespace | false) => void
): void {
if (this.parentNsps.size === 0) return fn(false);
Expand Down
9 changes: 5 additions & 4 deletions lib/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import debugModule from "debug";
import type { Server } from "./index";
import type { Client } from "./client";
import type { Namespace } from "./namespace";
import type { IncomingMessage } from "http";
import type { IncomingMessage, IncomingHttpHeaders } from "http";
import type {
Adapter,
BroadcastFlags,
Room,
SocketId,
} from "socket.io-adapter";
import base64id from "base64id";
import type { ParsedUrlQuery } from "querystring";

const debug = debugModule("socket.io:socket");

Expand All @@ -33,7 +34,7 @@ export interface Handshake {
/**
* The headers sent as part of the handshake
*/
headers: object;
headers: IncomingHttpHeaders;

/**
* The date of creation (as string)
Expand Down Expand Up @@ -68,12 +69,12 @@ export interface Handshake {
/**
* The query object
*/
query: object;
query: ParsedUrlQuery;

/**
* The auth object
*/
auth: object;
auth: { [key: string]: any };
}

export class Socket extends EventEmitter {
Expand Down

0 comments on commit 4f2e9a7

Please sign in to comment.