mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
fix(rest): remove const enums in favour of regular enums (#9243)
* fix(rest): remove `const enum`s in favour of regular enums The motivation is that `const enum` produces ambient const enums when compiling which in turn causes issues with TypeScript 5.x when `verbatimModuleSyntax` is enabled. Furthermore, the generally accepted best practice is to avoid `const enum`s when writing libraries. Can back this up with statements from TS maintainers if needed, I know they made them, I just can't be bothered to find the GitHub links lmao. @vladfrangu will probably be able to find those links much easier than me as it was also the motivation to remove `const enum`'s from discord-api-types * refactor(rest): restore `const enum` for internal enum --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -113,7 +113,7 @@ export interface RequestHeaders {
|
|||||||
/**
|
/**
|
||||||
* Possible API methods to be used when doing requests
|
* Possible API methods to be used when doing requests
|
||||||
*/
|
*/
|
||||||
export const enum RequestMethod {
|
export enum RequestMethod {
|
||||||
Delete = 'DELETE',
|
Delete = 'DELETE',
|
||||||
Get = 'GET',
|
Get = 'GET',
|
||||||
Patch = 'PATCH',
|
Patch = 'PATCH',
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const DefaultRestOptions = {
|
|||||||
/**
|
/**
|
||||||
* The events that the REST manager emits
|
* The events that the REST manager emits
|
||||||
*/
|
*/
|
||||||
export const enum RESTEvents {
|
export enum RESTEvents {
|
||||||
Debug = 'restDebug',
|
Debug = 'restDebug',
|
||||||
HandlerSweep = 'handlerSweep',
|
HandlerSweep = 'handlerSweep',
|
||||||
HashSweep = 'hashSweep',
|
HashSweep = 'hashSweep',
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
"newLine": "lf",
|
"newLine": "lf",
|
||||||
"noEmitHelpers": true,
|
"noEmitHelpers": true,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"preserveConstEnums": true,
|
|
||||||
"removeComments": false,
|
"removeComments": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user