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: Strengthen channel typings in appropriate places #6232

Merged
merged 7 commits into from
Jul 31, 2021

Conversation

Jiralite
Copy link
Member

Please describe the changes this PR makes and why it should be merged:
Per #5521, methods and typings that were solely for category channels (and ids) were instead allowing any channel to go through instead of just CategoryChannelResolvable. This pull request should address this and resolve #5521.

Additionally, this pull request changes the type definition for ChannelData. Before, it only could take the parent id (Snowflake) of a potential category channel, but now, it is possible to take a CategoryChannelResolvable instead. This means a rename is in order, so I've changed parentId here to just parent. This also makes it a breaking change, but this also matches nicely now with the GuildChannelCreateOptions type definition!

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
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

@Jiralite
Copy link
Member Author

I noticed there's a bunch of other places where the typings can be strengthened, so I'm going to add the following and apply them to hopefully everywhere with no missed instances:

  • @typedef {TextChannel|Snowflake} TextChannelResolvable
  • @typedef {VoiceChannel|Snowflake} VoiceChannelResolvable
  • @typedef {VoiceChannel|StageChannel|Snowflake} GuildVoiceChannelResolvable

@Jiralite Jiralite changed the title refactor: Use CategoryChannelResolvable in appropriate places refactor: Strengthen channel typings in appropriate places Jul 30, 2021
typings/index.d.ts Outdated Show resolved Hide resolved
Favouring "disconnect" here instead of "kick" as it is consistent with the documentation in VoiceState#setChannel().
@iCrawl iCrawl merged commit 65ae064 into discordjs:master Jul 31, 2021
@Jiralite Jiralite deleted the categorychannelresolvable branch July 31, 2021 08:57
IRONM00N pushed a commit to TanzaniteBot/discord.js that referenced this pull request Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use CategoryChannelResolvable for parent setting
4 participants