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

types(BaseButtonComponentData): Narrow component type #9735

Merged
merged 4 commits into from
Aug 11, 2023

Conversation

Jiralite
Copy link
Member

Please describe the changes this PR makes and why it should be merged:
Resolves #9734 by adding a specific ComponentType in BaseButtonComponentData. This caused some tests to fail, so I've fixed them up too.

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

@vercel
Copy link

vercel bot commented Jul 24, 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) Aug 11, 2023 7:12am
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Aug 11, 2023 7:12am

@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Merging #9735 (78be3ea) into main (447652e) will decrease coverage by 0.25%.
Report is 12 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #9735      +/-   ##
==========================================
- Coverage   57.43%   57.18%   -0.25%     
==========================================
  Files         232      232              
  Lines       15050    14738     -312     
  Branches     1126     1123       -3     
==========================================
- Hits         8644     8428     -216     
+ Misses       6366     6270      -96     
  Partials       40       40              
Flag Coverage Δ
brokers 63.16% <ø> (ø)
collection 99.87% <ø> (ø)
next ∅ <ø> (∅)
proxy 76.15% <ø> (-0.16%) ⬇️
rest 91.90% <ø> (-0.79%) ⬇️
util 70.55% <ø> (ø)
utilities 100.00% <ø> (ø)
voice 63.53% <ø> (ø)
website 0.00% <ø> (ø)
ws 52.38% <ø> (ø)

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

see 68 files with indirect coverage changes

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

@github-actions
Copy link

github-actions bot commented Aug 11, 2023

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 72
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 94
🟠 PWA 70

Lighthouse ran on https://discord-js-guide-git-types-narrow-button-type-discordjs.vercel.app/guide/home/introduction

@kodiakhq kodiakhq bot merged commit a30d46c into main Aug 11, 2023
7 checks passed
@kodiakhq kodiakhq bot deleted the types/narrow-button-type branch August 11, 2023 07:15
jaw0r3k added a commit to jaw0r3k/discord.js that referenced this pull request Aug 12, 2023
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
vladfrangu pushed a commit to jaw0r3k/discord.js that referenced this pull request Nov 4, 2023
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
vladfrangu pushed a commit that referenced this pull request Nov 5, 2023
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Vylpes pushed a commit to Vylpes/vylbot-app that referenced this pull request Dec 11, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [discord.js](https://discord.js.org) ([source](https://github.com/discordjs/discord.js)) | dependencies | minor | [`14.11.0` -> `14.14.1`](https://renovatebot.com/diffs/npm/discord.js/14.11.0/14.14.1) |

---

### Release Notes

<details>
<summary>discordjs/discord.js (discord.js)</summary>

### [`v14.14.1`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14141---2023-11-12)

[Compare Source](discordjs/discord.js@14.14.0...14.14.1)

#### Bug Fixes

-   **Emoji:** `id` set as `undefined` edge case ([#&#8203;9953](discordjs/discord.js#9953)) ([cc07a28](discordjs/discord.js@cc07a28))
-   **BaseClient:** Default in objects properly ([#&#8203;9952](discordjs/discord.js#9952)) ([f93abf7](discordjs/discord.js@f93abf7))

#### Documentation

-   Use preferred nullable syntax (`?T` over `T | null`) ([#&#8203;9946](discordjs/discord.js#9946)) ([1e4ef35](discordjs/discord.js@1e4ef35))

#### Refactor

-   Use formatters ([#&#8203;9956](discordjs/discord.js#9956)) ([40726db](discordjs/discord.js@40726db))

#### Typings

-   Use wrapper utilities ([#&#8203;9945](discordjs/discord.js#9945)) ([4bc1dae](discordjs/discord.js@4bc1dae))

### [`v14.14.0`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14140---2023-11-12)

[Compare Source](discordjs/discord.js@14.13.0...14.14.0)

#### Bug Fixes

-   **Client:** Ensure destroyed connections are not ready ([#&#8203;9942](discordjs/discord.js#9942)) ([b5e23ec](discordjs/discord.js@b5e23ec))
-   **Webhook:** Do not call `client.deleteWebhook` in `delete` ([#&#8203;9786](discordjs/discord.js#9786)) ([31d914e](discordjs/discord.js@31d914e))
-   **GuildManager#fetch:** Inject shard id ([#&#8203;9921](discordjs/discord.js#9921)) ([85753a9](discordjs/discord.js@85753a9))
-   Prevent 'undefined' debug message on intentional shard closure ([#&#8203;9846](discordjs/discord.js#9846)) ([0e0b85b](discordjs/discord.js@0e0b85b))
-   **Role:** Calculate position correctly when rawPositions are equal ([#&#8203;9871](discordjs/discord.js#9871)) ([0529b2a](discordjs/discord.js@0529b2a))
-   **GuildScheduledEvent:** Use `if...else` pattern and handle partials ([#&#8203;9802](discordjs/discord.js#9802)) ([32d614c](discordjs/discord.js@32d614c))

#### Documentation

-   **Message:** Remove duplicated word 'of' in description ([#&#8203;9923](discordjs/discord.js#9923)) ([85a78f9](discordjs/discord.js@85a78f9))
-   **GuildMember:** Clarify display color ([#&#8203;9891](discordjs/discord.js#9891)) ([e38d03f](discordjs/discord.js@e38d03f))
-   Remove duplicate `APIEmoji` ([#&#8203;9880](discordjs/discord.js#9880)) ([8cfadb6](discordjs/discord.js@8cfadb6))
-   Consolidate API types ([#&#8203;9881](discordjs/discord.js#9881)) ([44a3cbf](discordjs/discord.js@44a3cbf))
-   Remove `FileOptions` ([#&#8203;9855](discordjs/discord.js#9855)) ([eaabcdf](discordjs/discord.js@eaabcdf))
-   **DiscordjsErrorCodes:** Deprecate unused properties ([#&#8203;9790](discordjs/discord.js#9790)) ([4588e07](discordjs/discord.js@4588e07))
-   **ApplicationCommandManager:** Id parameter can take options ([#&#8203;9664](discordjs/discord.js#9664)) ([ed14135](discordjs/discord.js@ed14135))
-   **Attachment:** Add MIME types link to `contentType` ([#&#8203;9824](discordjs/discord.js#9824)) ([85b2498](discordjs/discord.js@85b2498))
-   Fix "its" typo ([#&#8203;9825](discordjs/discord.js#9825)) ([c50809e](discordjs/discord.js@c50809e))
-   **GuildMember:** Clarify timeout parameter wording ([#&#8203;9800](discordjs/discord.js#9800)) ([8d97e2d](discordjs/discord.js@8d97e2d))
-   **create-discord-bot:** Support bun in create-discord-bot ([#&#8203;9798](discordjs/discord.js#9798)) ([7157748](discordjs/discord.js@7157748))

#### Features

-   Default select menu values ([#&#8203;9867](discordjs/discord.js#9867)) ([4ff3ea4](discordjs/discord.js@4ff3ea4))
-   Mainlib docs on new website ([#&#8203;9930](discordjs/discord.js#9930)) ([da455bc](discordjs/discord.js@da455bc))
-   **cleanContent:** Add slash commands and emojis ([#&#8203;9809](discordjs/discord.js#9809)) ([c2349d4](discordjs/discord.js@c2349d4))
-   **Emoji:** Add `imageURL()` ([#&#8203;9788](discordjs/discord.js#9788)) ([b6c762c](discordjs/discord.js@b6c762c))
-   Onboarding mode and edit method ([#&#8203;9647](discordjs/discord.js#9647)) ([7671a83](discordjs/discord.js@7671a83))
-   Support new application properties and patch endpoint ([#&#8203;9709](discordjs/discord.js#9709)) ([1fe7247](discordjs/discord.js@1fe7247))
-   **BaseChannel:** Add `isThreadOnly()` ([#&#8203;9847](discordjs/discord.js#9847)) ([699b232](discordjs/discord.js@699b232))
-   **StageInstanceManager:** Add `guildScheduledEvent` to `create()` ([#&#8203;8885](discordjs/discord.js#8885)) ([931c3ed](discordjs/discord.js@931c3ed))
-   Support `default_thread_rate_limit_per_user` in channel creation ([#&#8203;9273](discordjs/discord.js#9273)) ([1e5c14b](discordjs/discord.js@1e5c14b))
-   Add media channels ([#&#8203;9662](discordjs/discord.js#9662)) ([571aedd](discordjs/discord.js@571aedd))
-   Support widget image URL ([#&#8203;9782](discordjs/discord.js#9782)) ([b6a2441](discordjs/discord.js@b6a2441))
-   **GuildAuditLogsEntry:** Expose extra integrationType in relevant log types ([#&#8203;9796](discordjs/discord.js#9796)) ([3109798](discordjs/discord.js@3109798))
-   Add support for teams update ([#&#8203;9805](discordjs/discord.js#9805)) ([c66636d](discordjs/discord.js@c66636d))
-   **Presence:** Expose sync_id in Activity ([#&#8203;9766](discordjs/discord.js#9766)) ([485dd71](discordjs/discord.js@485dd71))

#### Refactor

-   **utils:** Remove `mergeDefault` ([#&#8203;9938](discordjs/discord.js#9938)) ([5b0aa92](discordjs/discord.js@5b0aa92))
-   Use proper variable names in callbacks ([#&#8203;9840](discordjs/discord.js#9840)) ([11f6955](discordjs/discord.js@11f6955))
-   **GuildAuditLogsEntry:** Abstract reduce logic into a new function ([#&#8203;9845](discordjs/discord.js#9845)) ([19ea0ba](discordjs/discord.js@19ea0ba))
-   Stickers are free (no more "premium" packs) ([#&#8203;9791](discordjs/discord.js#9791)) ([e02a59b](discordjs/discord.js@e02a59b))

#### Typings

-   **Partials:** Add toString() method to supported Partials ([#&#8203;9835](discordjs/discord.js#9835)) ([7422d9f](discordjs/discord.js@7422d9f))
-   **MessageEditOptions:** Correct `attachments` type ([#&#8203;9874](discordjs/discord.js#9874)) ([2aa3250](discordjs/discord.js@2aa3250))
-   **UserContextMenuCommandInteraction:** Nullify `targetMember` ([#&#8203;9844](discordjs/discord.js#9844)) ([3c043d8](discordjs/discord.js@3c043d8))
-   Don't include dom types ([#&#8203;9831](discordjs/discord.js#9831)) ([9dbc954](discordjs/discord.js@9dbc954))
-   **Client:** Fix isReady narrowing ([#&#8203;9828](discordjs/discord.js#9828)) ([6404c01](discordjs/discord.js@6404c01))

### [`v14.13.0`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14130---2023-08-17)

[Compare Source](discordjs/discord.js@14.12.1...14.13.0)

#### Bug Fixes

-   **Action:** Do not add the client user as a recipient ([#&#8203;9774](discordjs/discord.js#9774)) ([24fbb11](discordjs/discord.js@24fbb11))
-   **DMChannel:** Correct partial typo ([#&#8203;9773](discordjs/discord.js#9773)) ([c1ff545](discordjs/discord.js@c1ff545))
-   **CachedManager:** Allow overriding constructor for makeCache ([#&#8203;9763](discordjs/discord.js#9763)) ([346fa57](discordjs/discord.js@346fa57))
-   **types:** Fixed CachedManager constructor arguments in type ([#&#8203;9761](discordjs/discord.js#9761)) ([b3c85d3](discordjs/discord.js@b3c85d3))
-   **Action:** Do not set `undefined` values ([#&#8203;9755](discordjs/discord.js#9755)) ([d8e3755](discordjs/discord.js@d8e3755))

#### Documentation

-   **EmbedBuilder:** `@readonly` length ([#&#8203;9778](discordjs/discord.js#9778)) ([8f572a6](discordjs/discord.js@8f572a6))
-   **WebhookEditOptions:** Add all of the types ([#&#8203;9776](discordjs/discord.js#9776)) ([d5be424](discordjs/discord.js@d5be424))
-   Update Node.js requirement to 16.11.0 ([#&#8203;9764](discordjs/discord.js#9764)) ([188877c](discordjs/discord.js@188877c))

#### Features

-   **Client:** Add deleteWebhook method ([#&#8203;9777](discordjs/discord.js#9777)) ([d90ba8d](discordjs/discord.js@d90ba8d))
-   **ClientPresence:** Allow setting activity state ([#&#8203;9743](discordjs/discord.js#9743)) ([9ed1b59](discordjs/discord.js@9ed1b59))
-   **ClientApplication:** Approximate guild count and new `GET` route ([#&#8203;9713](discordjs/discord.js#9713)) ([632a9b4](discordjs/discord.js@632a9b4))
-   **Role:** Add `flags` ([#&#8203;9694](discordjs/discord.js#9694)) ([3b18e5b](discordjs/discord.js@3b18e5b))
-   **Attachment:** Add `flags` ([#&#8203;9686](discordjs/discord.js#9686)) ([692f0fc](discordjs/discord.js@692f0fc))
-   Add `Client#webhooksUpdate` ([#&#8203;9732](discordjs/discord.js#9732)) ([0de071d](discordjs/discord.js@0de071d))

#### Typings

-   **GuildInvitableChannelResolvable:** Allow forum channels ([#&#8203;9775](discordjs/discord.js#9775)) ([727dc09](discordjs/discord.js@727dc09))
-   Make activity name required ([#&#8203;9765](discordjs/discord.js#9765)) ([0a9a3ed](discordjs/discord.js@0a9a3ed))
-   **BaseButtonComponentData:** Narrow component type ([#&#8203;9735](discordjs/discord.js#9735)) ([a30d46c](discordjs/discord.js@a30d46c))

### [`v14.12.1`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14121---2023-08-01)

[Compare Source](discordjs/discord.js@14.12.0...14.12.1)

#### Bug Fixes

-   **BaseClient:** Fix destroy method ([#&#8203;9742](discordjs/discord.js#9742)) ([1af7e5a](discordjs/discord.js@1af7e5a))

### [`v14.12.0`](https://github.com/discordjs/discord.js/blob/HEAD/packages/discord.js/CHANGELOG.md#14120---2023-07-31)

[Compare Source](discordjs/discord.js@14.11.0...14.12.0)

#### Bug Fixes

-   **ChannelUpdate:** Check against unknown channels ([#&#8203;9697](discordjs/discord.js#9697)) ([7fb91c5](discordjs/discord.js@7fb91c5))
-   **Action:** Use existing recipients if available ([#&#8203;9653](discordjs/discord.js#9653)) ([719e54a](discordjs/discord.js@719e54a))
-   Everyone role members ([#&#8203;9685](discordjs/discord.js#9685)) ([0803eb5](discordjs/discord.js@0803eb5))
-   `awaitMessageComponent` with `MessageComponentInteraction`s ([#&#8203;8598](discordjs/discord.js#8598)) ([b61e4fb](discordjs/discord.js@b61e4fb))
-   **ThreadManager:** Fix internal crash upon conditionally resolving thread members ([#&#8203;9648](discordjs/discord.js#9648)) ([a6dbe16](discordjs/discord.js@a6dbe16))
-   **User:** Check global name in equals ([#&#8203;9631](discordjs/discord.js#9631)) ([8f3bd38](discordjs/discord.js@8f3bd38))
-   **WebSocketManager:** Await WebSocket destroy ([#&#8203;9519](discordjs/discord.js#9519)) ([75308f2](discordjs/discord.js@75308f2))
-   **Client:** Safe call for possibly null WebSocket ([#&#8203;9600](discordjs/discord.js#9600)) ([24a6149](discordjs/discord.js@24a6149))
-   **ThreadManager:** Ensure `fetchActive()` only returns active threads in a channel ([#&#8203;9568](discordjs/discord.js#9568)) ([53aa24d](discordjs/discord.js@53aa24d))
-   **LimitedCollection:** Allow items to be stored if keepOverLimit is true when maxSize is 0 ([#&#8203;9534](discordjs/discord.js#9534)) ([9345d1b](discordjs/discord.js@9345d1b))
-   **AutocompleteInteraction:** Prevent snake casing of locales ([#&#8203;9565](discordjs/discord.js#9565)) ([7196fe3](discordjs/discord.js@7196fe3))

#### Documentation

-   Change `Channel` to `BaseChannel` ([#&#8203;9718](discordjs/discord.js#9718)) ([e5effb6](discordjs/discord.js@e5effb6))
-   **BaseChannel:** Remove `APIChannel` ([#&#8203;9717](discordjs/discord.js#9717)) ([125405f](discordjs/discord.js@125405f))
-   **BuildersSelectMenuOption:** Update link ([#&#8203;9690](discordjs/discord.js#9690)) ([ede9f4e](discordjs/discord.js@ede9f4e))
-   **ClientOptions:** Change default value of sweepers in docs ([#&#8203;9591](discordjs/discord.js#9591)) ([911e6ef](discordjs/discord.js@911e6ef))
-   **Client:** Correct invite gateway permission checks ([#&#8203;9597](discordjs/discord.js#9597)) ([e1b6eee](discordjs/discord.js@e1b6eee))
-   Fix broken links to new documentation ([#&#8203;9563](discordjs/discord.js#9563)) ([d01e8aa](discordjs/discord.js@d01e8aa))

#### Features

-   Add ws option support for "buildIdentifyThrottler" ([#&#8203;9728](discordjs/discord.js#9728)) ([6307f81](discordjs/discord.js@6307f81))
-   **Client:** Add `guildAvailable` event ([#&#8203;9692](discordjs/discord.js#9692)) ([3c85fb2](discordjs/discord.js@3c85fb2))
-   User avatar decorations ([#&#8203;8914](discordjs/discord.js#8914)) ([8d97017](discordjs/discord.js@8d97017))
-   Add silent option to ShardingManager ([#&#8203;9506](discordjs/discord.js#9506)) ([df40dcd](discordjs/discord.js@df40dcd))
-   **EmbedBuilder:** Add `.length` ([#&#8203;8682](discordjs/discord.js#8682)) ([53c17e0](discordjs/discord.js@53c17e0))
-   Guild onboarding ([#&#8203;9120](discordjs/discord.js#9120)) ([dc73c93](discordjs/discord.js@dc73c93))
-   Add resume event in shard ([#&#8203;9650](discordjs/discord.js#9650)) ([a73d54e](discordjs/discord.js@a73d54e))
-   **presence:** Re-introduce image resolving for other platforms ([#&#8203;9637](discordjs/discord.js#9637)) ([73c2f8a](discordjs/discord.js@73c2f8a))
-   Add message to send resume event to shard ([#&#8203;9626](discordjs/discord.js#9626)) ([a873ec1](discordjs/discord.js@a873ec1))
-   Support new username system ([#&#8203;9512](discordjs/discord.js#9512)) ([1ab60f9](discordjs/discord.js@1ab60f9))
-   **GuildAuditLogsEntry#extra:** Add missing `channel` property ([#&#8203;9518](discordjs/discord.js#9518)) ([2272321](discordjs/discord.js@2272321))

#### Performance

-   **Channel:** Linear speed position getter ([#&#8203;9497](discordjs/discord.js#9497)) ([09b0382](discordjs/discord.js@09b0382))
-   **Role:** Improve `members` getter ([#&#8203;9529](discordjs/discord.js#9529)) ([37181ab](discordjs/discord.js@37181ab))

#### Refactor

-   **User:** Remove deprecation warning from tag ([#&#8203;9660](discordjs/discord.js#9660)) ([cf8012c](discordjs/discord.js@cf8012c))
-   **GuildMember:** Make `_roles` property non-enumerable ([#&#8203;9387](discordjs/discord.js#9387)) ([46167a7](discordjs/discord.js@46167a7))
-   **rest:** Switch api to fetch-like and provide strategies ([#&#8203;9416](discordjs/discord.js#9416)) ([cdaa0a3](discordjs/discord.js@cdaa0a3))
    -   **BREAKING CHANGE:** NodeJS v18+ is required when using node due to the use of global `fetch`
    -   **BREAKING CHANGE:** The raw method of REST now returns a web compatible `Respone` object.
    -   **BREAKING CHANGE:** The `parseResponse` utility method has been updated to operate on a web compatible `Response` object.
    -   **BREAKING CHANGE:** Many underlying internals have changed, some of which were exported.
    -   **BREAKING CHANGE:** `DefaultRestOptions` used to contain a default `agent`, which is now set to `null` instead.

#### Typings

-   **MessageManager:** Allow comparison of messages again ([#&#8203;9612](discordjs/discord.js#9612)) ([a48d0ef](discordjs/discord.js@a48d0ef))
-   **AutoModerationActionExecution:** Add forum channels as a possible type in `channel()` ([#&#8203;9623](discordjs/discord.js#9623)) ([d64330a](discordjs/discord.js@d64330a))
-   **ModalSubmitFields:** Components is an array ([#&#8203;9406](discordjs/discord.js#9406)) ([1cab79f](discordjs/discord.js@1cab79f))
-   Use `readonly` arrays and `const` type parameters in places ([#&#8203;9641](discordjs/discord.js#9641)) ([cd69868](discordjs/discord.js@cd69868))
-   **BaseInteraction:** `appPermissions` not `null` in guilds ([#&#8203;9601](discordjs/discord.js#9601)) ([6c2242f](discordjs/discord.js@6c2242f))

</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://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/351
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
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.

ButtonComponentData fails type guard field check
5 participants