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: added TextBasedChannels type #6286

Conversation

kyranet
Copy link
Member

@kyranet kyranet commented Aug 3, 2021

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

At the moment, if Discord adds a new channel type, we have to update the types in many places, this creates issues as far as the type consistency go, such as MessageCollector not accepting NewsChannel as a valid channel type.

I also considered #6262 as an alternative fix for this, however, a generic type doesn't have many of the benefits from an union, such as being able to exclude certain types (channel.guild ? <channel is TextChannel | NewsChannel | ThreadChannel> : <channel is DMChannel | PartialDMChannel>).

I also made a typedef in the JavaScript side so the documentation for it is readily available in the documentation website, and refactored the TS type for TextBasedChannelTypes to read the new type's type field, so any change we do to TextBasedChannels will reflect on it.

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 only includes non-code changes, like changes to documentation, README, etc.
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

@kyranet kyranet added this to the Version 13 milestone Aug 3, 2021
@kyranet kyranet force-pushed the refactor/add-and-use-shared-text-based-channels branch from 4f7ad3e to 1c1b128 Compare August 3, 2021 10:08
@iCrawl iCrawl merged commit 61db5f7 into discordjs:master Aug 3, 2021
@kyranet kyranet deleted the refactor/add-and-use-shared-text-based-channels branch January 7, 2022 20:05
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.

3 participants