mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
refactor: use interfaces for AsyncEventEmitter event maps (#10044)
* refactor: use interfaces for AsyncEventEmitter event maps * refactor: apply suggestions from code review and add tests * refactor: better errors on missing dispatch types
This commit is contained in:
@@ -86,7 +86,7 @@
|
||||
"@discordjs/util": "workspace:^",
|
||||
"@sapphire/async-queue": "^1.5.0",
|
||||
"@sapphire/snowflake": "^3.5.1",
|
||||
"@vladfrangu/async_event_emitter": "^2.2.2",
|
||||
"@vladfrangu/async_event_emitter": "^2.2.4",
|
||||
"discord-api-types": "0.37.61",
|
||||
"magic-bytes.js": "^1.5.0",
|
||||
"tslib": "^2.6.2",
|
||||
|
||||
@@ -18,7 +18,7 @@ import { RequestMethod } from './utils/types.js';
|
||||
import type {
|
||||
RESTOptions,
|
||||
ResponseLike,
|
||||
RestEventsMap,
|
||||
RestEvents,
|
||||
HashData,
|
||||
InternalRequest,
|
||||
RouteLike,
|
||||
@@ -31,7 +31,7 @@ import { isBufferLike, parseResponse } from './utils/utils.js';
|
||||
/**
|
||||
* Represents the class that manages handlers for endpoints
|
||||
*/
|
||||
export class REST extends AsyncEventEmitter<RestEventsMap> {
|
||||
export class REST extends AsyncEventEmitter<RestEvents> {
|
||||
/**
|
||||
* The {@link https://undici.nodejs.org/#/docs/api/Agent | Agent} for all requests
|
||||
* performed by this manager.
|
||||
|
||||
@@ -14,9 +14,7 @@ export interface RestEvents {
|
||||
restDebug: [info: string];
|
||||
}
|
||||
|
||||
export type RestEventsMap = {
|
||||
[K in keyof RestEvents]: RestEvents[K];
|
||||
};
|
||||
export interface RestEventsMap extends RestEvents {}
|
||||
|
||||
/**
|
||||
* Options to be passed when creating the REST instance
|
||||
|
||||
Reference in New Issue
Block a user