types: fix setType() parameter and ChannelData.type (#8089)

This commit is contained in:
Almeida
2022-06-13 22:43:10 +01:00
committed by GitHub
parent 9c0f190de1
commit b4e28a8ff6
2 changed files with 6 additions and 3 deletions

View File

@@ -529,8 +529,8 @@ export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
reason?: string,
): Promise<this>;
public setTopic(topic: string | null, reason?: string): Promise<this>;
public setType(type: Pick<typeof ChannelType, 'GuildText'>, reason?: string): Promise<TextChannel>;
public setType(type: Pick<typeof ChannelType, 'GuildNews'>, reason?: string): Promise<NewsChannel>;
public setType(type: ChannelType.GuildText, reason?: string): Promise<TextChannel>;
public setType(type: ChannelType.GuildNews, reason?: string): Promise<NewsChannel>;
}
export class BaseGuildVoiceChannel extends GuildChannel {
@@ -3853,7 +3853,7 @@ export interface ChannelCreationOverwrites {
export interface ChannelData {
name?: string;
type?: Pick<typeof ChannelType, 'GuildText' | 'GuildNews'>;
type?: ChannelType.GuildText | ChannelType.GuildNews;
position?: number;
topic?: string | null;
nsfw?: boolean;

View File

@@ -1033,6 +1033,9 @@ expectType<TextBasedChannelFields['send']>(voiceChannel.send);
expectAssignable<PartialTextBasedChannelFields>(user);
expectAssignable<PartialTextBasedChannelFields>(guildMember);
expectType<Promise<NewsChannel>>(textChannel.setType(ChannelType.GuildNews));
expectType<Promise<TextChannel>>(newsChannel.setType(ChannelType.GuildText));
expectType<Message | null>(dmChannel.lastMessage);
expectType<Message | null>(threadChannel.lastMessage);
expectType<Message | null>(newsChannel.lastMessage);