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: add generic to ActionRowBuilder.from() #8414

Merged

Conversation

Syjalo
Copy link
Contributor

@Syjalo Syjalo commented Aug 2, 2022

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

@vercel
Copy link

vercel bot commented Aug 2, 2022

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 vercel bot temporarily deployed to Preview August 2, 2022 10:16 Inactive
@Syjalo Syjalo changed the title types: add generic to ActionRowBuilder#from() types: add generic to ActionRowBuilder.from() Aug 2, 2022
@Jiralite Jiralite added this to the discord.js v14.2 milestone Aug 2, 2022
Copy link
Member

@Jiralite Jiralite left a comment

Choose a reason for hiding this comment

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

Can you add tests?

@vercel vercel bot temporarily deployed to Preview August 2, 2022 16:30 Inactive
Copy link
Member

@Jiralite Jiralite left a comment

Choose a reason for hiding this comment

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

This needs a rebase + tests.

@vercel
Copy link

vercel bot commented Oct 13, 2022

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

A member of the Team first needs to authorize it.

@codecov
Copy link

codecov bot commented Oct 13, 2022

Codecov Report

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

❗ 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%) ⬆️
collection 100.00% <ø> (ø)
proxy 81.53% <ø> (+4.16%) ⬆️
rest 92.06% <ø> (+0.08%) ⬆️
util 100.00% <ø> (ø)
utilities 100.00% <ø> (ø)
voice 63.70% <ø> (-0.08%) ⬇️
ws 59.83% <ø> (+1.08%) ⬆️

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%) ⬇️
packages/ws/src/utils/constants.ts 83.87% <0.00%> (-1.85%) ⬇️
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

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

@kodiakhq kodiakhq bot merged commit 153352a into discordjs:main Dec 23, 2022
@Syjalo Syjalo deleted the add-generic-to-ActionRowBuilder#from() branch December 23, 2022 20:01
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.

None yet

8 participants