discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

types: add generic to `ActionRowBuilder.from()`

Open Syjalo opened this issue 2 years ago • 1 comments

Please describe the changes this PR makes and why it should be merged: This PR adds generic type to ActionRowBuilder.from(). Currently we can create typed ActionRowBuilder using the .from() static method only these ways.

<ActionRowBuilder<ButtonBuilder>>ActionRowBuilder.from();
ActionRowBuilder.from() as ActionRowBuilder<ButtonBuilder>;

But these ways are wrong, because we can create an ActionRowBuilder<ButtonBuilder>, but type it as ActionRowBuilder<SelectMenuBuilder>. This PR adds a new correct way to do that.

ActionRowBuilder.from<ButtonBuilder>();

Now the return type is typed and you can't add other types of action rows to the .from() method.

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating

Syjalo avatar Aug 02 '22 10:08 Syjalo

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

2 Ignored Deployments
Name Status Preview Comments Updated
discord-js ⬜️ Ignored (Inspect) Dec 23, 2022 at 7:27PM (UTC)
discord-js-guide ⬜️ Ignored (Inspect) Dec 23, 2022 at 7:27PM (UTC)

vercel[bot] avatar Aug 02 '22 10:08 vercel[bot]

@Syjalo is attempting to deploy a commit to the discordjs Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 13 '22 16:10 vercel[bot]

Codecov Report

Merging #8414 (7210eb2) into main (18b3a19) will increase coverage by 2.49%. The diff coverage is n/a.

:exclamation: Current head 7210eb2 differs from pull request most recent head 550f6d8. Consider uploading reports for the commit 550f6d8 to get more accurate results

@@            Coverage Diff             @@
##             main    #8414      +/-   ##
==========================================
+ Coverage   84.35%   86.85%   +2.49%     
==========================================
  Files          98       87      -11     
  Lines        9180     8808     -372     
  Branches     1096     1117      +21     
==========================================
- Hits         7744     7650      -94     
+ Misses       1394     1116     -278     
  Partials       42       42              
Flag Coverage Δ
brokers ?
builders 100.00% <ø> (+1.77%) :arrow_up:
collection 100.00% <ø> (ø)
proxy 81.53% <ø> (+4.16%) :arrow_up:
rest 92.06% <ø> (+0.08%) :arrow_up:
util 100.00% <ø> (ø)
utilities 100.00% <ø> (ø)
voice 63.70% <ø> (-0.08%) :arrow_down:
ws 59.83% <ø> (+1.08%) :arrow_up:

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

Impacted Files Coverage Δ
...trategies/context/SimpleContextFetchingStrategy.ts 71.42% <0.00%> (-12.79%) :arrow_down:
packages/ws/src/utils/constants.ts 83.87% <0.00%> (-1.85%) :arrow_down:
packages/collection/src/collection.ts 100.00% <0.00%> (ø)
packages/ws/src/utils/IdentifyThrottler.ts 100.00% <0.00%> (ø)
packages/builders/src/components/ActionRow.ts 100.00% <0.00%> (ø)
packages/ws/src/strategies/sharding/worker.ts 0.00% <0.00%> (ø)
packages/builders/src/components/Assertions.ts 100.00% <0.00%> (ø)
...src/strategies/context/IContextFetchingStrategy.ts 100.00% <0.00%> (ø)
...ilders/src/components/selectMenu/RoleSelectMenu.ts
...ilders/src/components/selectMenu/BaseSelectMenu.ts
... and 24 more

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

codecov[bot] avatar Oct 13 '22 16:10 codecov[bot]