From c6e16c36758a789f3167179bedeac759fddf7943 Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Sat, 18 Jan 2025 08:38:00 +0100 Subject: [PATCH] types(ThreadOnlyChannel): remove incorrect `messages` property (#10708) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * types(ThreadOnlyChannel): remove incorrect `messages` property Co-authored-by: TÆMBØ * test: t e s t s * test: revamp tests --------- Co-authored-by: TÆMBØ Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- packages/discord.js/typings/index.d.ts | 1 + packages/discord.js/typings/index.test-d.ts | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 5c6270f19..3c1f8064e 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2653,6 +2653,7 @@ export interface ThreadOnlyChannel | 'awaitMessages' | 'createMessageComponentCollector' | 'awaitMessageComponent' + | 'messages' > {} export abstract class ThreadOnlyChannel extends GuildChannel { public type: ChannelType.GuildForum | ChannelType.GuildMedia; diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index a88921b5f..29204e713 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -213,6 +213,7 @@ import { PollData, InteractionCallbackResponse, GuildScheduledEventRecurrenceRuleOptions, + ThreadOnlyChannel, } from '.'; import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd'; import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders'; @@ -2453,6 +2454,16 @@ declare const partialGroupDMChannel: PartialGroupDMChannel; declare const categoryChannel: CategoryChannel; declare const stageChannel: StageChannel; declare const forumChannel: ForumChannel; +declare const mediaChannel: MediaChannel; +declare const threadOnlyChannel: ThreadOnlyChannel; + +// Threads have messages. +expectType(threadChannel.messages); + +// Thread-only channels have threads—not messages. +notPropertyOf(threadOnlyChannel, 'messages'); +notPropertyOf(forumChannel, 'messages'); +notPropertyOf(mediaChannel, 'messages'); await forumChannel.edit({ availableTags: [...forumChannel.availableTags, { name: 'tag' }],