mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
types: fix setType() parameter and ChannelData.type (#8089)
This commit is contained in:
6
packages/discord.js/typings/index.d.ts
vendored
6
packages/discord.js/typings/index.d.ts
vendored
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user