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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect typings #552

Merged
merged 7 commits into from Oct 31, 2019

Conversation

Skillz4Killz
Copy link
Contributor

@Skillz4Killz Skillz4Killz commented Oct 27, 2019

This PR fixes the createChannel typings.

  1. The current typings make it impossible for anyone to create a channel as it expects a string and Typescript throws errors because in reality it requires a number. Not being able to pass a number is preventing me from making channels. HIGH PRIORITY PLEASE Can we consider hotpatching this into master as its only typings changes but its a massive issue. 馃檹
    image

  2. Although it is labelled as an optional at the moment, the type is required making it incorrect as well. This should also be fixed now to make it properly optional.
    image

  3. reason is a parameter and was not present in the typings. It is now.

  4. Added some overloads to the typings for createChannel for it to be much cleaner for TS devs. Now depending on the type that is provided, it will return the proper Channel Type as well.

  • Providing no type or providing the 0 type will return TextChannel
    image
  • Providing 2 will return VoiceChannel
    image
  • Providing 4 will return the CategoryChannel
    image
  • Providing any other number will return unknown. Let me know if you would prefer to keep this as <AnyGuildChannel>

This PR also fixes the following:

  • channelMentions typings and JSDocs. ChannelMentions can never be undefined.
  • category.channels can never be undefined it will always be a collection. Also changed categor.channels from returning a Collection<AnyGuildChannel> => Collection<TextChannel | VoiceChannel>

@Skillz4Killz Skillz4Killz changed the title Fix create channel types [Urgent] Bug Fix create channel types preventing creation of channels Oct 27, 2019
@Skillz4Killz Skillz4Killz changed the title [Urgent] Bug Fix create channel types preventing creation of channels [Urgent] Bug Fix createChannel types preventing creation of channels Oct 27, 2019
@Skillz4Killz Skillz4Killz changed the title [Urgent] Bug Fix createChannel types preventing creation of channels [Urgent] createChannel Bug Fix preventing creation of channels Oct 27, 2019
@Skillz4Killz Skillz4Killz changed the title [Urgent] createChannel Bug Fix preventing creation of channels Fix incorrect typings Oct 29, 2019
@abalabahaha abalabahaha merged commit 1527843 into abalabahaha:dev Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants