fix(Channel): narrow thread creation message and result types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
almeidx
2026-04-13 10:05:05 +01:00
parent bece6b84ee
commit 0c3830e839
5 changed files with 217 additions and 132 deletions

View File

@@ -713,7 +713,7 @@ export type RESTPutAPIChannelRecipientResult = unknown;
export type RESTDeleteAPIChannelRecipientResult = unknown;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-from-message}
*/
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
/**
@@ -731,40 +731,15 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-from-message}
*/
export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: RESTPostAPIChannelMessageJSONBody;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
export type RESTPostAPIChannelMessagesThreadsResult =
| APIAnnouncementThreadChannel
| APIPrivateThreadChannel
| APIPublicThreadChannel;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsFormDataBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: string;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
*/
export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-without-message}
*/
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
/**
@@ -782,13 +757,59 @@ export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMes
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-without-message}
*/
export type RESTPostAPIChannelThreadsResult =
| APIAnnouncementThreadChannel
| APIPrivateThreadChannel
| APIPublicThreadChannel;
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object}
*/
export type RESTAPIForumThreadMessageParams = Pick<
RESTPostAPIChannelMessageJSONBody,
'allowed_mentions' | 'attachments' | 'components' | 'content' | 'embeds' | 'flags' | 'sticker_ids'
>;
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: RESTAPIForumThreadMessageParams;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsFormDataBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: string;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export interface RESTPostAPIGuildForumThreadsResult extends APIPublicThreadChannel {
/**
* The message that was created with the thread
*/
message: APIMessage;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#join-thread}
*/

View File

@@ -726,7 +726,7 @@ export type RESTPutAPIChannelRecipientResult = unknown;
export type RESTDeleteAPIChannelRecipientResult = unknown;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-from-message}
*/
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
/**
@@ -744,40 +744,15 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-from-message}
*/
export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: RESTPostAPIChannelMessageJSONBody;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
export type RESTPostAPIChannelMessagesThreadsResult =
| APIAnnouncementThreadChannel
| APIPrivateThreadChannel
| APIPublicThreadChannel;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsFormDataBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: string;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
*/
export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-without-message}
*/
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
/**
@@ -795,13 +770,59 @@ export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMes
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-without-message}
*/
export type RESTPostAPIChannelThreadsResult =
| APIAnnouncementThreadChannel
| APIPrivateThreadChannel
| APIPublicThreadChannel;
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object}
*/
export type RESTAPIForumThreadMessageParams = Pick<
RESTPostAPIChannelMessageJSONBody,
'allowed_mentions' | 'attachments' | 'components' | 'content' | 'embeds' | 'flags' | 'sticker_ids'
>;
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: RESTAPIForumThreadMessageParams;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsFormDataBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: string;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export interface RESTPostAPIGuildForumThreadsResult extends APIPublicThreadChannel {
/**
* The message that was created with the thread
*/
message: APIMessage;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#join-thread}
*/

View File

@@ -309,6 +309,7 @@ export default config([
'RESTAPIInteractionCallbackObject',
'RESTAPIInteractionCallbackResourceObject',
'RESTAPIMessageReference',
'RESTAPIForumThreadMessageParams',
'RESTAPIPartialCurrentUserGuild',
'RESTAPIPoll',
'RESTOAuth2TokenOptionalClientCredentials',

View File

@@ -713,7 +713,7 @@ export type RESTPutAPIChannelRecipientResult = unknown;
export type RESTDeleteAPIChannelRecipientResult = unknown;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-from-message}
*/
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
/**
@@ -731,40 +731,15 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-from-message}
*/
export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: RESTPostAPIChannelMessageJSONBody;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
export type RESTPostAPIChannelMessagesThreadsResult =
| APIAnnouncementThreadChannel
| APIPrivateThreadChannel
| APIPublicThreadChannel;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsFormDataBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: string;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
*/
export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-without-message}
*/
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
/**
@@ -782,13 +757,59 @@ export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMes
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-without-message}
*/
export type RESTPostAPIChannelThreadsResult =
| APIAnnouncementThreadChannel
| APIPrivateThreadChannel
| APIPublicThreadChannel;
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object}
*/
export type RESTAPIForumThreadMessageParams = Pick<
RESTPostAPIChannelMessageJSONBody,
'allowed_mentions' | 'attachments' | 'components' | 'content' | 'embeds' | 'flags' | 'sticker_ids'
>;
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: RESTAPIForumThreadMessageParams;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsFormDataBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: string;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export interface RESTPostAPIGuildForumThreadsResult extends APIPublicThreadChannel {
/**
* The message that was created with the thread
*/
message: APIMessage;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#join-thread}
*/

View File

@@ -726,7 +726,7 @@ export type RESTPutAPIChannelRecipientResult = unknown;
export type RESTDeleteAPIChannelRecipientResult = unknown;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-from-message}
*/
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
/**
@@ -744,40 +744,15 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-from-message}
*/
export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: RESTPostAPIChannelMessageJSONBody;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
export type RESTPostAPIChannelMessagesThreadsResult =
| APIAnnouncementThreadChannel
| APIPrivateThreadChannel
| APIPublicThreadChannel;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsFormDataBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: string;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
*/
export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-without-message}
*/
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
/**
@@ -795,13 +770,59 @@ export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMes
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-without-message}
*/
export type RESTPostAPIChannelThreadsResult =
| APIAnnouncementThreadChannel
| APIPrivateThreadChannel
| APIPublicThreadChannel;
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object}
*/
export type RESTAPIForumThreadMessageParams = Pick<
RESTPostAPIChannelMessageJSONBody,
'allowed_mentions' | 'attachments' | 'components' | 'content' | 'embeds' | 'flags' | 'sticker_ids'
>;
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: RESTAPIForumThreadMessageParams;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export type RESTPostAPIGuildForumThreadsFormDataBody = RESTPostAPIChannelMessagesThreadsJSONBody & {
/**
* The initial message of the thread
*/
message: string;
/**
* The IDs of the set of tags to apply to the thread; limited to 5
*/
applied_tags?: Snowflake[] | undefined;
};
/**
* @see {@link https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel}
*/
export interface RESTPostAPIGuildForumThreadsResult extends APIPublicThreadChannel {
/**
* The message that was created with the thread
*/
message: APIMessage;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#join-thread}
*/