diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index b99f9e4d88..eea68c0b16 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -44,8 +44,8 @@ declare class WebSocket extends events.EventEmitter { close(code?: number, data?: string): void; ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void; pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void; - send(data: any, cb?: (err: Error) => void): void; - send(data: any, options: { mask?: boolean; binary?: boolean; compress?: boolean; fin?: boolean }, cb?: (err: Error) => void): void; + send(data: any, cb?: (err?: Error) => void): void; + send(data: any, options: { mask?: boolean; binary?: boolean; compress?: boolean; fin?: boolean }, cb?: (err?: Error) => void): void; terminate(): void; // HTML5 WebSocket events diff --git a/types/ws/ws-tests.ts b/types/ws/ws-tests.ts index bc62d9de98..7819236855 100644 --- a/types/ws/ws-tests.ts +++ b/types/ws/ws-tests.ts @@ -22,6 +22,8 @@ import * as https from 'https'; wss.on('connection', (ws, req) => { ws.on('message', (message) => console.log('received: %s', message)); ws.send('something'); + ws.send('something', (error?: Error) => {}); + ws.send('something', {}, (error?: Error) => {}); }); wss.on('upgrade', (res) => {