mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
types: Fix channel create overloads (#7294)
This commit is contained in:
14
packages/discord.js/typings/index.d.ts
vendored
14
packages/discord.js/typings/index.d.ts
vendored
@@ -499,7 +499,6 @@ export class CategoryChannel extends GuildChannel {
|
|||||||
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,
|
||||||
@@ -2832,17 +2831,18 @@ 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;
|
||||||
|
|
||||||
|
public create<T extends Exclude<GuildChannelTypes, ChannelType.GuildStore>>(
|
||||||
|
name: string,
|
||||||
|
options: GuildChannelCreateOptions & { type: T },
|
||||||
|
): Promise<MappedGuildChannelTypes[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 create(
|
public create(
|
||||||
name: string,
|
name: string,
|
||||||
options: GuildChannelCreateOptions & { type: ChannelType.GuildStore },
|
options: GuildChannelCreateOptions & { type: ChannelType.GuildStore },
|
||||||
): Promise<StoreChannel>;
|
): Promise<StoreChannel>;
|
||||||
/** @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information */
|
|
||||||
public create<T extends CategoryChannelType | ChannelType.GuildCategory>(
|
public create(name: string, options?: GuildChannelCreateOptions): Promise<TextChannel>;
|
||||||
name: string,
|
|
||||||
options: GuildChannelCreateOptions & { type: T },
|
|
||||||
): Promise<MappedGuildChannelTypes[T]>;
|
|
||||||
public create(name: string, options: GuildChannelCreateOptions): Promise<NonThreadGuildBasedChannel>;
|
|
||||||
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>;
|
||||||
|
|||||||
@@ -915,6 +915,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: ChannelType.GuildVoice }));
|
expectType<Promise<VoiceChannel>>(guildChannelManager.create('name', { type: ChannelType.GuildVoice }));
|
||||||
expectType<Promise<CategoryChannel>>(guildChannelManager.create('name', { type: ChannelType.GuildCategory }));
|
expectType<Promise<CategoryChannel>>(guildChannelManager.create('name', { type: ChannelType.GuildCategory }));
|
||||||
expectType<Promise<TextChannel>>(guildChannelManager.create('name', { type: ChannelType.GuildText }));
|
expectType<Promise<TextChannel>>(guildChannelManager.create('name', { type: ChannelType.GuildText }));
|
||||||
|
|||||||
Reference in New Issue
Block a user