diff --git a/types/uws/index.d.ts b/types/uws/index.d.ts index 6072c41534..20a024c1b8 100644 --- a/types/uws/index.d.ts +++ b/types/uws/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for uWS 0.13 // Project: https://github.com/uWebSockets/uWebSockets // Definitions by: York Yao +// Orblazer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -59,13 +60,13 @@ declare class WebSocket extends events.EventEmitter { addEventListener(method: string, listener?: (...args: any[]) => void): void; // Events - on(event: 'error', cb: (err: Error) => void): this; - on(event: 'close', cb: (code: number, message: string) => void): this; - on(event: 'message', cb: (data: any, flags: { binary: boolean }) => void): this; - on(event: 'ping', cb: (data: any, flags: { binary: boolean }) => void): this; - on(event: 'pong', cb: (data: any, flags: { binary: boolean }) => void): this; - on(event: 'open', cb: () => void): this; - on(event: string, listener: (...args: any[]) => void): this; + on(event: 'error', cb: (this: this, err: Error) => void): this; + on(event: 'close', cb: (this: this, code: number, message: string) => void): this; + on(event: 'message', cb: (this: this, data: any, flags: { binary: boolean }) => void): this; + on(event: 'ping', cb: (this: this, data: any, flags: { binary: boolean }) => void): this; + on(event: 'pong', cb: (this: this, data: any, flags: { binary: boolean }) => void): this; + on(event: 'open', cb: (this: this) => void): this; + on(event: string, listener: (this: this, ...args: any[]) => void): this; addListener(event: 'error', cb: (err: Error) => void): this; addListener(event: 'close', cb: (code: number, message: string) => void): this; @@ -141,7 +142,7 @@ declare namespace WebSocket { // Events on(event: 'error', cb: (err: Error) => void): this; on(event: 'headers', cb: (headers: string[]) => void): this; - on(event: 'connection', cb: (client: WebSocket) => void): this; + on(event: 'connection', cb: (this: WebSocket, client: WebSocket) => void): this; on(event: string, listener: (...args: any[]) => void): this; addListener(event: 'error', cb: (err: Error) => void): this;