mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +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:
@@ -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