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

refactor: use interfaces for AsyncEventEmitter event maps #10044

Merged
merged 4 commits into from
Dec 14, 2023

Conversation

Qjuh
Copy link
Contributor

@Qjuh Qjuh commented Dec 10, 2023

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

Turn the mapped types for events in rest/REST, ws/WebSocketManager, ws/WebSocketShard and core/Client into interfaces for better documentation purposes.

Also turns WebSocketManagerOptions into an interface for the same reason.

Some interfaces are simple aliases of already existing interfaces, to keep the named export and make this possible as a non-breaking change even in TS land.

@discordjs/brokers still uses types for event maps, but they are dynamic so not as easily adjustable.

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

Copy link

vercel bot commented Dec 10, 2023

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

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 1:15pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 1:15pm

Copy link

codecov bot commented Dec 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (651ffc2) 58.34% compared to head (ea6be60) 58.36%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10044      +/-   ##
==========================================
+ Coverage   58.34%   58.36%   +0.02%     
==========================================
  Files         241      241              
  Lines       17158    17168      +10     
  Branches     1242     1242              
==========================================
+ Hits        10010    10020      +10     
  Misses       7103     7103              
  Partials       45       45              
Flag Coverage Δ
brokers 63.49% <ø> (ø)
builders 95.53% <ø> (ø)
collection 99.32% <ø> (ø)
formatters 99.47% <ø> (ø)
guide 0.00% <ø> (ø)
next ∅ <ø> (∅)
proxy 75.00% <ø> (ø)
rest 92.87% <100.00%> (-0.01%) ⬇️
util 70.70% <ø> (ø)
utilities 100.00% <ø> (ø)
voice 63.64% <ø> (ø)
website 0.00% <ø> (ø)
ws 52.76% <100.00%> (+0.26%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ckohen ckohen left a comment

Choose a reason for hiding this comment

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

Unless you had a specific reason in mind for not doing this, please also change the generics in extends to the initial interface so the empty extends can be removed easily in the next major.

@Qjuh Qjuh requested a review from ckohen December 11, 2023 08:02
@kodiakhq kodiakhq bot merged commit adfd9cd into discordjs:main Dec 14, 2023
22 checks passed
@Qjuh Qjuh deleted the refactor/ws-event-types-docs branch December 14, 2023 20:11
Vylpes pushed a commit to Vylpes/card-drop that referenced this pull request May 20, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@discordjs/rest](https://discord.js.org) ([source](https://github.com/discordjs/discord.js)) | dependencies | minor | [`2.2.0` -> `2.3.0`](https://renovatebot.com/diffs/npm/@discordjs%2frest/2.2.0/2.3.0) |

---

### Release Notes

<details>
<summary>discordjs/discord.js (@&#8203;discordjs/rest)</summary>

### [`v2.3.0`](https://github.com/discordjs/discord.js/blob/HEAD/packages/rest/CHANGELOG.md#discordjsrest230---2024-05-04)

[Compare Source](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected])

#### Bug Fixes

-   Anchor link for events ([0efd1be](discordjs/discord.js@0efd1be))

#### Documentation

-   Split docs.api.json into multiple json files ([597340f](discordjs/discord.js@597340f))
-   Remove hyphen after `@returns` ([#&#8203;9989](discordjs/discord.js#9989)) ([e9ff991](discordjs/discord.js@e9ff991))

#### Features

-   Local and preview detection ([79fbda3](discordjs/discord.js@79fbda3))
-   **REST:** Dynamic rate limit offsets ([#&#8203;10099](discordjs/discord.js#10099)) ([278396e](discordjs/discord.js@278396e))

#### Refactor

-   Docs ([#&#8203;10126](discordjs/discord.js#10126)) ([18cce83](discordjs/discord.js@18cce83))
-   Use interfaces for AsyncEventEmitter event maps ([#&#8203;10044](discordjs/discord.js#10044)) ([adfd9cd](discordjs/discord.js@adfd9cd))

#### Styling

-   Fix up lint ([d869d9b](discordjs/discord.js@d869d9b))

#### Testing

-   Skip flaky rest test ([#&#8203;10234](discordjs/discord.js#10234)) ([dc8f149](discordjs/discord.js@dc8f149))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://git.vylpes.xyz/External/card-drop/pulls/232
Reviewed-by: Vylpes <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
Vylpes pushed a commit to Vylpes/vylbot-app that referenced this pull request Jun 25, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@discordjs/rest](https://discord.js.org) ([source](https://github.com/discordjs/discord.js)) | dependencies | minor | [`2.2.0` -> `2.3.0`](https://renovatebot.com/diffs/npm/@discordjs%2frest/2.2.0/2.3.0) |

---

### Release Notes

<details>
<summary>discordjs/discord.js (@&#8203;discordjs/rest)</summary>

### [`v2.3.0`](https://github.com/discordjs/discord.js/blob/HEAD/packages/rest/CHANGELOG.md#discordjsrest230---2024-05-04)

[Compare Source](https://github.com/discordjs/discord.js/compare/@discordjs/[email protected]...@discordjs/[email protected])

#### Bug Fixes

-   Anchor link for events ([0efd1be](discordjs/discord.js@0efd1be))

#### Documentation

-   Split docs.api.json into multiple json files ([597340f](discordjs/discord.js@597340f))
-   Remove hyphen after `@returns` ([#&#8203;9989](discordjs/discord.js#9989)) ([e9ff991](discordjs/discord.js@e9ff991))

#### Features

-   Local and preview detection ([79fbda3](discordjs/discord.js@79fbda3))
-   **REST:** Dynamic rate limit offsets ([#&#8203;10099](discordjs/discord.js#10099)) ([278396e](discordjs/discord.js@278396e))

#### Refactor

-   Docs ([#&#8203;10126](discordjs/discord.js#10126)) ([18cce83](discordjs/discord.js@18cce83))
-   Use interfaces for AsyncEventEmitter event maps ([#&#8203;10044](discordjs/discord.js#10044)) ([adfd9cd](discordjs/discord.js@adfd9cd))

#### Styling

-   Fix up lint ([d869d9b](discordjs/discord.js@d869d9b))

#### Testing

-   Skip flaky rest test ([#&#8203;10234](discordjs/discord.js#10234)) ([dc8f149](discordjs/discord.js@dc8f149))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/vylbot-app/pulls/435
Reviewed-by: Vylpes <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
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.

6 participants