diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index d69be3f982cd..51520b653bca 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -647,7 +647,9 @@ export class BaseGuildEmoji extends Emoji { public requiresColons: boolean | null; } -export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel, true) { +// tslint:disable-next-line no-empty-interface +export interface BaseGuildTextChannel extends TextBasedChannelFields, GuildChannel {} +export class BaseGuildTextChannel extends GuildChannel { protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean); public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration; public defaultThreadRateLimitPerUser: number | null; @@ -666,10 +668,11 @@ export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel, tr public setType(type: ChannelType.GuildAnnouncement, reason?: string): Promise; } -export class BaseGuildVoiceChannel extends TextBasedChannelMixin(GuildChannel, true, [ - 'lastPinTimestamp', - 'lastPinAt', -]) { +// tslint:disable-next-line no-empty-interface +export interface BaseGuildVoiceChannel + extends Omit, 'lastPinTimestamp' | 'lastPinAt'>, + GuildChannel {} +export class BaseGuildVoiceChannel extends GuildChannel { public constructor(guild: Guild, data?: RawGuildChannelData); public bitrate: number; public get full(): boolean; @@ -1289,13 +1292,14 @@ export interface ResolvedFile { contentType?: string; } -export class DMChannel extends TextBasedChannelMixin(BaseChannel, false, [ - 'bulkDelete', - 'fetchWebhooks', - 'createWebhook', - 'setRateLimitPerUser', - 'setNSFW', -]) { +// tslint:disable-next-line no-empty-interface +export interface DMChannel + extends Omit< + TextBasedChannelFields, + 'bulkDelete' | 'fetchWebhooks' | 'createWebhook' | 'setRateLimitPerUser' | 'setNSFW' + >, + BaseChannel {} +export class DMChannel extends BaseChannel { private constructor(client: Client, data?: RawDMChannelData); public flags: Readonly; public recipientId: Snowflake; @@ -1574,7 +1578,8 @@ export class GuildMemberFlagsBitField extends BitField { public static resolve(bit?: BitFieldResolvable): number; } -export class GuildMember extends PartialTextBasedChannel(Base) { +export interface GuildMember extends PartialTextBasedChannelFields, Base {} +export class GuildMember extends Base { private constructor(client: Client, data: RawGuildMemberData, guild: Guild); private _roles: Snowflake[]; public avatar: string | null; @@ -1925,7 +1930,9 @@ export class InteractionCollector exte public once(event: string, listener: (...args: any[]) => void): this; } -export class InteractionWebhook extends PartialWebhookMixin() { +// tslint:disable-next-line no-empty-interface +export interface InteractionWebhook extends PartialWebhookFields {} +export class InteractionWebhook { public constructor(client: Client, id: Snowflake, token: string); public readonly client: Client; public token: string; @@ -2469,17 +2476,21 @@ export interface DefaultReactionEmoji { name: string | null; } -export abstract class ThreadOnlyChannel extends TextBasedChannelMixin(GuildChannel, true, [ - 'send', - 'lastMessage', - 'lastPinAt', - 'bulkDelete', - 'sendTyping', - 'createMessageCollector', - 'awaitMessages', - 'createMessageComponentCollector', - 'awaitMessageComponent', -]) { +export interface ThreadOnlyChannel + extends Omit< + TextBasedChannelFields, + | 'send' + | 'lastMessage' + | 'lastPinAt' + | 'bulkDelete' + | 'sendTyping' + | 'createMessageCollector' + | 'awaitMessages' + | 'createMessageComponentCollector' + | 'awaitMessageComponent' + >, + GuildChannel {} +export abstract class ThreadOnlyChannel extends GuildChannel { public type: ChannelType.GuildForum | ChannelType.GuildMedia; public threads: GuildForumThreadManager; public availableTags: GuildForumTag[]; @@ -3139,11 +3150,11 @@ export interface PrivateThreadChannel extends ThreadChannel { type: ChannelType.PrivateThread; } -export class ThreadChannel extends TextBasedChannelMixin(BaseChannel, true, [ - 'fetchWebhooks', - 'createWebhook', - 'setNSFW', -]) { +// tslint:disable-next-line no-empty-interface +export interface ThreadChannel + extends Omit, 'fetchWebhooks' | 'createWebhook' | 'setNSFW'>, + BaseChannel {} +export class ThreadChannel extends BaseChannel { private constructor(guild: Guild, data?: RawThreadChannelData, client?: Client); public archived: boolean | null; public get archivedAt(): Date | null; @@ -3238,7 +3249,9 @@ export class Typing extends Base { }; } -export class User extends PartialTextBasedChannel(Base) { +// tslint:disable-next-line no-empty-interface +export interface User extends PartialTextBasedChannelFields, Base {} +export class User extends Base { protected constructor(client: Client, data: RawUserData); private _equals(user: APIUser): boolean; @@ -3491,7 +3504,9 @@ export class VoiceState extends Base { public edit(options: VoiceStateEditOptions): Promise; } -export class Webhook extends WebhookMixin() { +// tslint:disable-next-line no-empty-interface +export interface Webhook extends WebhookFields {} +export class Webhook { private constructor(client: Client, data?: RawWebhookData); public avatar: string | null; public avatarURL(options?: ImageURLOptions): string | null; @@ -3537,7 +3552,9 @@ export class Webhook extends WebhookMixin() { public send(options: string | MessagePayload | WebhookMessageCreateOptions): Promise; } -export class WebhookClient extends WebhookMixin(BaseClient) { +// tslint:disable-next-line no-empty-interface +export interface WebhookClient extends WebhookFields, BaseClient {} +export class WebhookClient extends BaseClient { public constructor(data: WebhookClientData, options?: WebhookClientOptions); public readonly client: this; public options: WebhookClientOptions; @@ -4485,22 +4502,6 @@ export class VoiceStateManager extends CachedManager = abstract new (...args: any[]) => Entity; -/** @internal */ -export function PartialTextBasedChannel( - Base?: Constructable, -): Constructable>; - -/** @internal */ -export function TextBasedChannelMixin< - Entity, - InGuild extends boolean = boolean, - IgnoredFields extends keyof TextBasedChannelFields = never, ->( - Base?: Constructable, - inGuild?: InGuild, - ignore?: IgnoredFields[], -): Constructable, IgnoredFields>>; - export interface PartialTextBasedChannelFields { send(options: string | MessagePayload | MessageCreateOptions): Promise>; } @@ -4531,11 +4532,6 @@ export interface TextBasedChannelFields setNSFW(nsfw?: boolean, reason?: string): Promise; } -/** @internal */ -export function PartialWebhookMixin(Base?: Constructable): Constructable; -/** @internal */ -export function WebhookMixin(Base?: Constructable): Constructable; - /** @internal */ export interface PartialWebhookFields { id: Snowflake;