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:
Jeroen Claassens
2023-03-19 15:35:27 +01:00
committed by GitHub
parent 2e8e95031c
commit 229ad077ff
3 changed files with 2 additions and 3 deletions

View File

@@ -113,7 +113,7 @@ export interface RequestHeaders {
/**
* Possible API methods to be used when doing requests
*/
export const enum RequestMethod {
export enum RequestMethod {
Delete = 'DELETE',
Get = 'GET',
Patch = 'PATCH',

View File

@@ -34,7 +34,7 @@ export const DefaultRestOptions = {
/**
* The events that the REST manager emits
*/
export const enum RESTEvents {
export enum RESTEvents {
Debug = 'restDebug',
HandlerSweep = 'handlerSweep',
HashSweep = 'hashSweep',

View File

@@ -28,7 +28,6 @@
"newLine": "lf",
"noEmitHelpers": true,
"outDir": "dist",
"preserveConstEnums": true,
"removeComments": false,
"sourceMap": true,
"esModuleInterop": true,