Open
Description
class Server extends WebSocket.Server {
on(event: 'connection', cb: (this: WebSocket, socket: WebSocket, request: http.IncomingMessage) => void): this;
on(event: 'error', cb: (this: WebSocket, error: Error) => void): this;
on(event: 'headers', cb: (this: WebSocket, headers: string[], request: http.IncomingMessage) => void): this;
on(event: 'listening', cb: (this: WebSocket) => void): this;
on(event: 'stream', cb: (this: WebSocket, stream: WebSocketDuplex, request: http.IncomingMessage) => void): this;
on(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
}
should become
class Server extends WebSocket.Server {
on(event: 'connection', cb: (this: WebSocket.Server, socket: WebSocket, request: http.IncomingMessage) => void): this;
on(event: 'error', cb: (this: WebSocket.Server, error: Error) => void): this;
on(event: 'headers', cb: (this: WebSocket.Server, headers: string[], request: http.IncomingMessage) => void): this;
on(event: 'listening', cb: (this: WebSocket.Server) => void): this;
on(event: 'stream', cb: (this: WebSocket.Server, stream: WebSocketDuplex, request: http.IncomingMessage) => void): this;
on(event: string | symbol, listener: (this: WebSocket.Server, ...args: any[]) => void): this;
}
in index.d.ts
to avoid TypeScript errors. Or better yet, because Server extends WebSocket.Server, these should be removed all together (unless it is currently serving a greater purpose).
Looks like PR #152 resolves this issue.
Metadata
Metadata
Assignees
Labels
No labels