mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-21 08:24:42 +12:00
types(DirectoryChannel): Ensure directory channels cannot contain user mentions when stringified (#10043)
* types(DirectoryChannel): `ChannelMention` `toString()` * refactor: dynamic test
This commit is contained in:
parent
a000df624c
commit
db56324624
2 changed files with 10 additions and 9 deletions
1
packages/discord.js/typings/index.d.ts
vendored
1
packages/discord.js/typings/index.d.ts
vendored
|
@ -2888,6 +2888,7 @@ export class DirectoryChannel extends BaseChannel {
|
||||||
public guild: InviteGuild;
|
public guild: InviteGuild;
|
||||||
public guildId: Snowflake;
|
public guildId: Snowflake;
|
||||||
public name: string;
|
public name: string;
|
||||||
|
public toString(): ChannelMention;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StageInstance extends Base {
|
export class StageInstance extends Base {
|
||||||
|
|
|
@ -186,6 +186,8 @@ import {
|
||||||
Emoji,
|
Emoji,
|
||||||
PartialEmoji,
|
PartialEmoji,
|
||||||
Awaitable,
|
Awaitable,
|
||||||
|
Channel,
|
||||||
|
DirectoryChannel,
|
||||||
} from '.';
|
} from '.';
|
||||||
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||||
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
||||||
|
@ -2282,16 +2284,12 @@ declare const anyComponentsActionRowComp: ActionRow<ActionRowComponent>;
|
||||||
expectType<ActionRowBuilder>(ActionRowBuilder.from(anyComponentsActionRowData));
|
expectType<ActionRowBuilder>(ActionRowBuilder.from(anyComponentsActionRowData));
|
||||||
expectType<ActionRowBuilder>(ActionRowBuilder.from(anyComponentsActionRowComp));
|
expectType<ActionRowBuilder>(ActionRowBuilder.from(anyComponentsActionRowComp));
|
||||||
|
|
||||||
declare const stageChannel: StageChannel;
|
type UserMentionChannels = DMChannel | PartialDMChannel;
|
||||||
declare const partialGroupDMChannel: PartialGroupDMChannel;
|
declare const channelMentionChannels: Exclude<Channel | DirectoryChannel, UserMentionChannels>;
|
||||||
|
declare const userMentionChannels: UserMentionChannels;
|
||||||
|
|
||||||
expectType<ChannelMention>(textChannel.toString());
|
expectType<ChannelMention>(channelMentionChannels.toString());
|
||||||
expectType<ChannelMention>(voiceChannel.toString());
|
expectType<UserMention>(userMentionChannels.toString());
|
||||||
expectType<ChannelMention>(newsChannel.toString());
|
|
||||||
expectType<ChannelMention>(threadChannel.toString());
|
|
||||||
expectType<ChannelMention>(stageChannel.toString());
|
|
||||||
expectType<ChannelMention>(partialGroupDMChannel.toString());
|
|
||||||
expectType<UserMention>(dmChannel.toString());
|
|
||||||
expectType<UserMention>(user.toString());
|
expectType<UserMention>(user.toString());
|
||||||
expectType<UserMention>(guildMember.toString());
|
expectType<UserMention>(guildMember.toString());
|
||||||
|
|
||||||
|
@ -2313,7 +2311,9 @@ expectType<Promise<Message>>(interactionWebhook.send('content'));
|
||||||
expectType<Promise<Message>>(interactionWebhook.editMessage(snowflake, 'content'));
|
expectType<Promise<Message>>(interactionWebhook.editMessage(snowflake, 'content'));
|
||||||
expectType<Promise<Message>>(interactionWebhook.fetchMessage(snowflake));
|
expectType<Promise<Message>>(interactionWebhook.fetchMessage(snowflake));
|
||||||
|
|
||||||
|
declare const partialGroupDMChannel: PartialGroupDMChannel;
|
||||||
declare const categoryChannel: CategoryChannel;
|
declare const categoryChannel: CategoryChannel;
|
||||||
|
declare const stageChannel: StageChannel;
|
||||||
declare const forumChannel: ForumChannel;
|
declare const forumChannel: ForumChannel;
|
||||||
|
|
||||||
await forumChannel.edit({
|
await forumChannel.edit({
|
||||||
|
|
Loading…
Reference in a new issue