Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rest): remove const enums in favour of regular enums #9243

Merged
merged 3 commits into from
Mar 19, 2023

Conversation

favna
Copy link
Contributor

@favna favna commented Mar 17, 2023

Please describe the changes this PR makes and why it should be merged:

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 enums 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.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

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
@vercel
Copy link

vercel bot commented Mar 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
discord-js ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 19, 2023 at 2:32PM (UTC)
discord-js-guide ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 19, 2023 at 2:32PM (UTC)

@Jiralite Jiralite added this to the rest 1.7.0 milestone Mar 17, 2023
@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

Merging #9243 (a904ad4) into main (9842082) will increase coverage by 0.12%.
The diff coverage is 100.00%.

❗ Current head a904ad4 differs from pull request most recent head 791e035. Consider uploading reports for the commit 791e035 to get more accurate results

@@            Coverage Diff             @@
##             main    #9243      +/-   ##
==========================================
+ Coverage   83.57%   83.70%   +0.12%     
==========================================
  Files         100      100              
  Lines        9567     9550      -17     
  Branches     1101     1101              
==========================================
- Hits         7996     7994       -2     
+ Misses       1532     1517      -15     
  Partials       39       39              
Flag Coverage Δ
proxy 79.56% <ø> (ø)
rest 92.07% <100.00%> (ø)
ws 58.12% <ø> (+0.41%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/rest/src/lib/RequestManager.ts 89.83% <100.00%> (ø)
packages/rest/src/lib/utils/constants.ts 98.24% <100.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@SpaceEEC SpaceEEC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants