@@ -2186,7 +2186,7 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2186
2186
public removeAttachments ( ) : Promise < Message < InGuild > > ;
2187
2187
public reply ( options : string | MessagePayload | MessageReplyOptions ) : Promise < Message < InGuild > > ;
2188
2188
public resolveComponent ( customId : string ) : MessageActionRowComponent | null ;
2189
- public startThread ( options : StartThreadOptions ) : Promise < AnyThreadChannel > ;
2189
+ public startThread ( options : StartThreadOptions ) : Promise < PublicThreadChannel < false > > ;
2190
2190
public suppressEmbeds ( suppress ?: boolean ) : Promise < Message < InGuild > > ;
2191
2191
public toJSON ( ) : unknown ;
2192
2192
public toString ( ) : string ;
@@ -3249,7 +3249,9 @@ export class TextChannel extends BaseGuildTextChannel {
3249
3249
public type : ChannelType . GuildText ;
3250
3250
}
3251
3251
3252
- export type AnyThreadChannel < Forum extends boolean = boolean > = PublicThreadChannel < Forum > | PrivateThreadChannel ;
3252
+ export type ForumThreadChannel = PublicThreadChannel < true > ;
3253
+ export type TextThreadChannel = PublicThreadChannel < false > | PrivateThreadChannel ;
3254
+ export type AnyThreadChannel = TextThreadChannel | ForumThreadChannel ;
3253
3255
3254
3256
export interface PublicThreadChannel < Forum extends boolean = boolean > extends ThreadChannel < Forum > {
3255
3257
type : ChannelType . PublicThread | ChannelType . AnnouncementThread ;
@@ -3298,28 +3300,25 @@ export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseCha
3298
3300
public type : ThreadChannelType ;
3299
3301
public get unarchivable ( ) : boolean ;
3300
3302
public delete ( reason ?: string ) : Promise < this> ;
3301
- public edit ( options : ThreadEditOptions ) : Promise < AnyThreadChannel > ;
3302
- public join ( ) : Promise < AnyThreadChannel > ;
3303
- public leave ( ) : Promise < AnyThreadChannel > ;
3303
+ public edit ( options : ThreadEditOptions ) : Promise < this > ;
3304
+ public join ( ) : Promise < this > ;
3305
+ public leave ( ) : Promise < this > ;
3304
3306
public permissionsFor ( memberOrRole : GuildMember | Role , checkAdmin ?: boolean ) : Readonly < PermissionsBitField > ;
3305
3307
public permissionsFor (
3306
3308
memberOrRole : GuildMemberResolvable | RoleResolvable ,
3307
3309
checkAdmin ?: boolean ,
3308
3310
) : Readonly < PermissionsBitField > | null ;
3309
3311
public fetchOwner ( options ?: BaseFetchOptions ) : Promise < ThreadMember | null > ;
3310
3312
public fetchStarterMessage ( options ?: BaseFetchOptions ) : Promise < Message < true > | null > ;
3311
- public setArchived ( archived ?: boolean , reason ?: string ) : Promise < AnyThreadChannel > ;
3312
- public setAutoArchiveDuration (
3313
- autoArchiveDuration : ThreadAutoArchiveDuration ,
3314
- reason ?: string ,
3315
- ) : Promise < AnyThreadChannel > ;
3316
- public setInvitable ( invitable ?: boolean , reason ?: string ) : Promise < AnyThreadChannel > ;
3317
- public setLocked ( locked ?: boolean , reason ?: string ) : Promise < AnyThreadChannel > ;
3318
- public setName ( name : string , reason ?: string ) : Promise < AnyThreadChannel > ;
3313
+ public setArchived ( archived ?: boolean , reason ?: string ) : Promise < this> ;
3314
+ public setAutoArchiveDuration ( autoArchiveDuration : ThreadAutoArchiveDuration , reason ?: string ) : Promise < this> ;
3315
+ public setInvitable ( invitable ?: boolean , reason ?: string ) : Promise < this> ;
3316
+ public setLocked ( locked ?: boolean , reason ?: string ) : Promise < this> ;
3317
+ public setName ( name : string , reason ?: string ) : Promise < this> ;
3319
3318
// The following 3 methods can only be run on forum threads.
3320
- public setAppliedTags ( appliedTags : readonly Snowflake [ ] , reason ?: string ) : Promise < ThreadChannel < true > > ;
3321
- public pin ( reason ?: string ) : Promise < ThreadChannel < true > > ;
3322
- public unpin ( reason ?: string ) : Promise < ThreadChannel < true > > ;
3319
+ public setAppliedTags ( appliedTags : readonly Snowflake [ ] , reason ?: string ) : Promise < If < ThreadOnly , this , never > > ;
3320
+ public pin ( reason ?: string ) : Promise < If < ThreadOnly , this , never > > ;
3321
+ public unpin ( reason ?: string ) : Promise < If < ThreadOnly , this , never > > ;
3323
3322
public toString ( ) : ChannelMention ;
3324
3323
}
3325
3324
@@ -4568,15 +4567,18 @@ export class StageInstanceManager extends CachedManager<Snowflake, StageInstance
4568
4567
4569
4568
export class ThreadManager < ThreadOnly extends boolean = boolean > extends CachedManager <
4570
4569
Snowflake ,
4571
- ThreadChannel < ThreadOnly > ,
4570
+ If < ThreadOnly , ForumThreadChannel , TextThreadChannel > ,
4572
4571
ThreadChannelResolvable
4573
4572
> {
4574
4573
protected constructor (
4575
4574
channel : TextChannel | NewsChannel | ForumChannel | MediaChannel ,
4576
4575
iterable ?: Iterable < RawThreadChannelData > ,
4577
4576
) ;
4578
4577
public channel : If < ThreadOnly , ForumChannel | MediaChannel , TextChannel | NewsChannel > ;
4579
- public fetch ( options : ThreadChannelResolvable , cacheOptions ?: BaseFetchOptions ) : Promise < AnyThreadChannel | null > ;
4578
+ public fetch (
4579
+ options : ThreadChannelResolvable ,
4580
+ cacheOptions ?: BaseFetchOptions ,
4581
+ ) : Promise < If < ThreadOnly , ForumThreadChannel , TextThreadChannel > | null > ;
4580
4582
public fetch (
4581
4583
options : FetchThreadsOptions & { archived : FetchArchivedThreadOptions } ,
4582
4584
cacheOptions ?: { cache ?: boolean } ,
@@ -4587,11 +4589,13 @@ export class ThreadManager<ThreadOnly extends boolean = boolean> extends CachedM
4587
4589
}
4588
4590
4589
4591
export class GuildTextThreadManager < AllowedThreadType > extends ThreadManager < false > {
4590
- public create ( options : GuildTextThreadCreateOptions < AllowedThreadType > ) : Promise < ThreadChannel > ;
4592
+ public create (
4593
+ options : GuildTextThreadCreateOptions < AllowedThreadType > ,
4594
+ ) : Promise < AllowedThreadType extends ChannelType . PrivateThread ? PrivateThreadChannel : PublicThreadChannel < false > > ;
4591
4595
}
4592
4596
4593
4597
export class GuildForumThreadManager extends ThreadManager < true > {
4594
- public create ( options : GuildForumThreadCreateOptions ) : Promise < ThreadChannel > ;
4598
+ public create ( options : GuildForumThreadCreateOptions ) : Promise < ForumThreadChannel > ;
4595
4599
}
4596
4600
4597
4601
export class ThreadMemberManager extends CachedManager < Snowflake , ThreadMember , ThreadMemberResolvable > {
@@ -6792,7 +6796,8 @@ export type Channel =
6792
6796
| NewsChannel
6793
6797
| StageChannel
6794
6798
| TextChannel
6795
- | AnyThreadChannel
6799
+ | PublicThreadChannel
6800
+ | PrivateThreadChannel
6796
6801
| VoiceChannel
6797
6802
| ForumChannel
6798
6803
| MediaChannel ;
@@ -6822,7 +6827,7 @@ export type TextChannelResolvable = Snowflake | TextChannel;
6822
6827
6823
6828
export type TextBasedChannelResolvable = Snowflake | TextBasedChannel ;
6824
6829
6825
- export type ThreadChannelResolvable = AnyThreadChannel | Snowflake ;
6830
+ export type ThreadChannelResolvable = Snowflake | ThreadChannel ;
6826
6831
6827
6832
export type ThreadChannelType = ChannelType . AnnouncementThread | ChannelType . PublicThread | ChannelType . PrivateThread ;
6828
6833
0 commit comments