types(voice): bring back typed events (#8109)

This commit is contained in:
Skick
2022-06-23 17:39:36 +07:00
committed by GitHub
parent af04992ed3
commit 70b42bb64a
6 changed files with 77 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/method-signature-style */
import { createSocket, Socket } from 'node:dgram';
import { EventEmitter } from 'node:events';
import { isIPv4 } from 'node:net';
@@ -50,6 +51,13 @@ const KEEP_ALIVE_LIMIT = 12;
*/
const MAX_COUNTER_VALUE = 2 ** 32 - 1;
export interface VoiceUDPSocket extends EventEmitter {
on(event: 'error', listener: (error: Error) => void): this;
on(event: 'close', listener: () => void): this;
on(event: 'debug', listener: (message: string) => void): this;
on(event: 'message', listener: (message: Buffer) => void): this;
}
/**
* Manages the UDP networking for a voice connection.
*/