From b441469044d46cee0c0d77a0303931bc88f6fee9 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Fri, 27 Mar 2020 20:58:11 +0100 Subject: [PATCH] revert: channel unions (#3918 69d69f2) (#3978) * revert: channel unions (#3918 69d69f25b964b6a2bb13bd086696abec17782ca3) * fix: correct tslint:disable * revert: keep the GuildChannel#setParent change Co-authored-by: Crawl --- src/structures/GuildChannel.js | 9 -------- typings/index.d.ts | 41 +++++++++++++++------------------- 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 2471f9e34094..2e80eca71222 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -576,15 +576,6 @@ class GuildChannel extends Channel { return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false); } - /** - * Whether this GuildChannel is a partial - * @type {boolean} - * @readonly - */ - get partial() { - return false; - } - /** * Whether the channel is viewable by the client user * @type {boolean} diff --git a/typings/index.d.ts b/typings/index.d.ts index cf6c05ba6539..fbbc9d29cc6e 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -145,7 +145,7 @@ declare module 'discord.js' { } export class CategoryChannel extends GuildChannel { - public readonly children: Collection>; + public readonly children: Collection; public type: 'category'; } @@ -156,8 +156,8 @@ declare module 'discord.js' { public deleted: boolean; public id: Snowflake; public type: keyof typeof ChannelType; - public delete(reason?: string): Promise; - public fetch(): Promise; + public delete(reason?: string): Promise; + public fetch(): Promise; public toString(): string; } @@ -558,7 +558,7 @@ declare module 'discord.js' { public recipient: User; public readonly partial: false; public type: 'dm'; - public fetch(): Promise; + public fetch(): Promise; } export class Emoji extends Base { @@ -578,7 +578,7 @@ declare module 'discord.js' { export class Guild extends Base { constructor(client: Client, data: object); private _sortedRoles(): Collection; - private _sortedChannels(channel: Channel): Collection; + private _sortedChannels(channel: Channel): Collection; private _memberSpeakUpdate(user: Snowflake, speaking: boolean): void; public readonly afkChannel: VoiceChannel | null; @@ -593,7 +593,7 @@ declare module 'discord.js' { public defaultMessageNotifications: DefaultMessageNotifications | number; public deleted: boolean; public description: string | null; - public embedChannel: GuildChannelTypes | null; + public embedChannel: GuildChannel | null; public embedChannelID: Snowflake | null; public embedEnabled: boolean; public emojis: GuildEmojiManager; @@ -726,7 +726,6 @@ declare module 'discord.js' { public readonly members: Collection; public name: string; public readonly parent: CategoryChannel | null; - public readonly partial: false; public parentID: Snowflake | null; public permissionOverwrites: Collection; public readonly permissionsLocked: boolean | null; @@ -879,7 +878,7 @@ declare module 'discord.js' { export class Invite extends Base { constructor(client: Client, data: object); - public channel: GuildChannelTypes | PartialGroupDMChannel; + public channel: GuildChannel | PartialGroupDMChannel; public code: string; public readonly deletable: boolean; public readonly createdAt: Date | null; @@ -996,11 +995,11 @@ declare module 'discord.js' { } export class MessageCollector extends Collector { - constructor(channel: TextBasedChannelTypes, filter: CollectorFilter, options?: MessageCollectorOptions); - private _handleChannelDeletion(channel: TextBasedChannelTypes): void; + constructor(channel: TextChannel | DMChannel, filter: CollectorFilter, options?: MessageCollectorOptions); + private _handleChannelDeletion(channel: GuildChannel): void; private _handleGuildDeletion(guild: Guild): void; - public channel: TextBasedChannelTypes; + public channel: Channel; public options: MessageCollectorOptions; public received: number; @@ -1063,7 +1062,7 @@ declare module 'discord.js' { roles: Snowflake[] | Collection, everyone: boolean, ); - private _channels: Collection | null; + private _channels: Collection | null; private readonly _content: Message; private _members: Collection | null; @@ -1072,7 +1071,7 @@ declare module 'discord.js' { public everyone: boolean; public readonly guild: Guild; public has( - data: User | GuildMember | Role | GuildChannelTypes, + data: User | GuildMember | Role | GuildChannel, options?: { ignoreDirect?: boolean; ignoreRoles?: boolean; @@ -1128,9 +1127,9 @@ declare module 'discord.js' { } export class PermissionOverwrites { - constructor(guildChannel: GuildChannelTypes, data?: object); + constructor(guildChannel: GuildChannel, data?: object); public allow: Readonly; - public readonly channel: GuildChannelTypes; + public readonly channel: GuildChannel; public deny: Readonly; public id: Snowflake; public type: OverwriteType; @@ -1171,7 +1170,7 @@ declare module 'discord.js' { export class ReactionCollector extends Collector { constructor(message: Message, filter: CollectorFilter, options?: ReactionCollectorOptions); - private _handleChannelDeletion(channel: TextBasedChannelTypes): void; + private _handleChannelDeletion(channel: GuildChannel): void; private _handleGuildDeletion(guild: Guild): void; private _handleMessageDeletion(message: Message): void; @@ -1810,9 +1809,9 @@ declare module 'discord.js' { //#region Managers - export class ChannelManager extends BaseManager { + export class ChannelManager extends BaseManager { constructor(client: Client, iterable: Iterable); - public fetch(id: Snowflake, cache?: boolean): Promise; + public fetch(id: Snowflake, cache?: boolean): Promise; } export abstract class BaseManager { @@ -1827,7 +1826,7 @@ declare module 'discord.js' { public resolveID(resolvable: R): K | null; } - export class GuildChannelManager extends BaseManager { + export class GuildChannelManager extends BaseManager { constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public create(name: string, options: GuildCreateChannelOptions & { type: 'voice' }): Promise; @@ -2160,10 +2159,6 @@ declare module 'discord.js' { position: number; } - type ChannelTypes = DMChannel | CategoryChannel | NewsChannel | StoreChannel | TextChannel | VoiceChannel; - type GuildChannelTypes = CategoryChannel | NewsChannel | StoreChannel | TextChannel | VoiceChannel; - type TextBasedChannelTypes = DMChannel | NewsChannel | TextChannel; - type ChannelResolvable = Channel | Snowflake; interface ClientApplicationAsset {