mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
types: V13 channel create overloads fix (#7480)
This commit is contained in:
17
typings/index.d.ts
vendored
17
typings/index.d.ts
vendored
@@ -500,11 +500,10 @@ export class CategoryChannel extends GuildChannel {
|
|||||||
public readonly children: Collection<Snowflake, Exclude<NonThreadGuildBasedChannel, CategoryChannel>>;
|
public readonly children: Collection<Snowflake, Exclude<NonThreadGuildBasedChannel, CategoryChannel>>;
|
||||||
public type: 'GUILD_CATEGORY';
|
public type: 'GUILD_CATEGORY';
|
||||||
|
|
||||||
public createChannel<T extends Exclude<CategoryChannelTypes, 'GUILD_STORE'>>(
|
public createChannel<T extends Exclude<CategoryChannelTypes, 'GUILD_STORE' | ChannelTypes.GUILD_STORE>>(
|
||||||
name: string,
|
name: string,
|
||||||
options: CategoryCreateChannelOptions & { type: T },
|
options: CategoryCreateChannelOptions & { type: T },
|
||||||
): Promise<MappedChannelCategoryTypes[T]>;
|
): Promise<MappedChannelCategoryTypes[T]>;
|
||||||
|
|
||||||
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
|
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
|
||||||
public createChannel(
|
public createChannel(
|
||||||
name: string,
|
name: string,
|
||||||
@@ -3009,13 +3008,19 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
|
|||||||
private constructor(guild: Guild, iterable?: Iterable<RawGuildChannelData>);
|
private constructor(guild: Guild, iterable?: Iterable<RawGuildChannelData>);
|
||||||
public readonly channelCountWithoutThreads: number;
|
public readonly channelCountWithoutThreads: number;
|
||||||
public guild: Guild;
|
public guild: Guild;
|
||||||
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
|
|
||||||
public create(name: string, options: GuildChannelCreateOptions & { type: 'GUILD_STORE' }): Promise<StoreChannel>;
|
public create<T extends Exclude<GuildChannelTypes, 'GUILD_STORE' | ChannelTypes.GUILD_STORE>>(
|
||||||
public create<T extends GuildChannelTypes>(
|
|
||||||
name: string,
|
name: string,
|
||||||
options: GuildChannelCreateOptions & { type: T },
|
options: GuildChannelCreateOptions & { type: T },
|
||||||
): Promise<MappedGuildChannelTypes[T]>;
|
): Promise<MappedGuildChannelTypes[T]>;
|
||||||
public create(name: string, options: GuildChannelCreateOptions): Promise<NonThreadGuildBasedChannel>;
|
|
||||||
|
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
|
||||||
|
public create(
|
||||||
|
name: string,
|
||||||
|
options: GuildChannelCreateOptions & { type: 'GUILD_STORE' | ChannelTypes.GUILD_STORE },
|
||||||
|
): Promise<StoreChannel>;
|
||||||
|
|
||||||
|
public create(name: string, options?: GuildChannelCreateOptions): Promise<TextChannel>;
|
||||||
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<NonThreadGuildBasedChannel | null>;
|
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<NonThreadGuildBasedChannel | null>;
|
||||||
public fetch(id?: undefined, options?: BaseFetchOptions): Promise<Collection<Snowflake, NonThreadGuildBasedChannel>>;
|
public fetch(id?: undefined, options?: BaseFetchOptions): Promise<Collection<Snowflake, NonThreadGuildBasedChannel>>;
|
||||||
public setPositions(channelPositions: readonly ChannelPosition[]): Promise<Guild>;
|
public setPositions(channelPositions: readonly ChannelPosition[]): Promise<Guild>;
|
||||||
|
|||||||
@@ -867,6 +867,8 @@ declare const guildChannelManager: GuildChannelManager;
|
|||||||
{
|
{
|
||||||
type AnyChannel = TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel;
|
type AnyChannel = TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel;
|
||||||
|
|
||||||
|
expectType<Promise<TextChannel>>(guildChannelManager.create('name'));
|
||||||
|
expectType<Promise<TextChannel>>(guildChannelManager.create('name', {}));
|
||||||
expectType<Promise<VoiceChannel>>(guildChannelManager.create('name', { type: 'GUILD_VOICE' }));
|
expectType<Promise<VoiceChannel>>(guildChannelManager.create('name', { type: 'GUILD_VOICE' }));
|
||||||
expectType<Promise<CategoryChannel>>(guildChannelManager.create('name', { type: 'GUILD_CATEGORY' }));
|
expectType<Promise<CategoryChannel>>(guildChannelManager.create('name', { type: 'GUILD_CATEGORY' }));
|
||||||
expectType<Promise<TextChannel>>(guildChannelManager.create('name', { type: 'GUILD_TEXT' }));
|
expectType<Promise<TextChannel>>(guildChannelManager.create('name', { type: 'GUILD_TEXT' }));
|
||||||
|
|||||||
Reference in New Issue
Block a user