From 790b4deb0f47a26a4051a94cbf07eb412bcbaf91 Mon Sep 17 00:00:00 2001 From: Denis-Adrian Cristea Date: Mon, 13 Oct 2025 12:26:03 +0300 Subject: [PATCH] refactor: improved channel types (#1397) --- deno/payloads/v10/channel.ts | 4 ++-- deno/payloads/v9/channel.ts | 4 ++-- deno/rest/v10/guild.ts | 3 ++- deno/rest/v9/guild.ts | 3 ++- payloads/v10/channel.ts | 4 ++-- payloads/v9/channel.ts | 4 ++-- rest/v10/guild.ts | 3 ++- rest/v9/guild.ts | 3 ++- tests/v10/channel.ts | 4 ++-- 9 files changed, 18 insertions(+), 14 deletions(-) diff --git a/deno/payloads/v10/channel.ts b/deno/payloads/v10/channel.ts index 3f720fbe..1c452a50 100644 --- a/deno/payloads/v10/channel.ts +++ b/deno/payloads/v10/channel.ts @@ -110,7 +110,7 @@ export interface APIPinChannel extends APIChannelBase last_pin_timestamp?: string | null; } -export interface APIGuildChannel extends APIChannelBase { +export interface APIGuildChannel extends APIChannelBase { /** * The name of the channel (1-100 characters) */ @@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel +export interface APIVoiceChannelBase extends APIGuildChannel, APISortableChannel, APITextBasedChannel, diff --git a/deno/payloads/v9/channel.ts b/deno/payloads/v9/channel.ts index b3642fc8..42de87a6 100644 --- a/deno/payloads/v9/channel.ts +++ b/deno/payloads/v9/channel.ts @@ -110,7 +110,7 @@ export interface APIPinChannel extends APIChannelBase last_pin_timestamp?: string | null; } -export interface APIGuildChannel extends APIChannelBase { +export interface APIGuildChannel extends APIChannelBase { /** * The name of the channel (1-100 characters) */ @@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel +export interface APIVoiceChannelBase extends APIGuildChannel, APISortableChannel, APITextBasedChannel, diff --git a/deno/rest/v10/guild.ts b/deno/rest/v10/guild.ts index 402ee470..3147c68d 100644 --- a/deno/rest/v10/guild.ts +++ b/deno/rest/v10/guild.ts @@ -28,6 +28,7 @@ import type { APIGuildOnboardingPromptOption, APIRoleColors, APIIncidentsData, + APIGuildChannel, } from '../../payloads/v10/mod.ts'; import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, @@ -357,7 +358,7 @@ export type RESTDeleteAPIGuildResult = never; /** * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels} */ -export type RESTGetAPIGuildChannelsResult = APIChannel[]; +export type RESTGetAPIGuildChannelsResult = APIGuildChannel[]; /** * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel} diff --git a/deno/rest/v9/guild.ts b/deno/rest/v9/guild.ts index e6c47ed3..b9e1176a 100644 --- a/deno/rest/v9/guild.ts +++ b/deno/rest/v9/guild.ts @@ -28,6 +28,7 @@ import type { APIGuildOnboardingPromptOption, APIRoleColors, APIIncidentsData, + APIGuildChannel, } from '../../payloads/v9/mod.ts'; import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, @@ -357,7 +358,7 @@ export type RESTDeleteAPIGuildResult = never; /** * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels} */ -export type RESTGetAPIGuildChannelsResult = APIChannel[]; +export type RESTGetAPIGuildChannelsResult = APIGuildChannel[]; /** * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel} diff --git a/payloads/v10/channel.ts b/payloads/v10/channel.ts index ef2b9ddf..46000922 100644 --- a/payloads/v10/channel.ts +++ b/payloads/v10/channel.ts @@ -110,7 +110,7 @@ export interface APIPinChannel extends APIChannelBase last_pin_timestamp?: string | null; } -export interface APIGuildChannel extends APIChannelBase { +export interface APIGuildChannel extends APIChannelBase { /** * The name of the channel (1-100 characters) */ @@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel +export interface APIVoiceChannelBase extends APIGuildChannel, APISortableChannel, APITextBasedChannel, diff --git a/payloads/v9/channel.ts b/payloads/v9/channel.ts index 47708a00..5b68368f 100644 --- a/payloads/v9/channel.ts +++ b/payloads/v9/channel.ts @@ -110,7 +110,7 @@ export interface APIPinChannel extends APIChannelBase last_pin_timestamp?: string | null; } -export interface APIGuildChannel extends APIChannelBase { +export interface APIGuildChannel extends APIChannelBase { /** * The name of the channel (1-100 characters) */ @@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel +export interface APIVoiceChannelBase extends APIGuildChannel, APISortableChannel, APITextBasedChannel, diff --git a/rest/v10/guild.ts b/rest/v10/guild.ts index 5b077f88..8fb465f2 100644 --- a/rest/v10/guild.ts +++ b/rest/v10/guild.ts @@ -28,6 +28,7 @@ import type { APIGuildOnboardingPromptOption, APIRoleColors, APIIncidentsData, + APIGuildChannel, } from '../../payloads/v10/index'; import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, @@ -357,7 +358,7 @@ export type RESTDeleteAPIGuildResult = never; /** * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels} */ -export type RESTGetAPIGuildChannelsResult = APIChannel[]; +export type RESTGetAPIGuildChannelsResult = APIGuildChannel[]; /** * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel} diff --git a/rest/v9/guild.ts b/rest/v9/guild.ts index e0b3637a..fa34ed90 100644 --- a/rest/v9/guild.ts +++ b/rest/v9/guild.ts @@ -28,6 +28,7 @@ import type { APIGuildOnboardingPromptOption, APIRoleColors, APIIncidentsData, + APIGuildChannel, } from '../../payloads/v9/index'; import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, @@ -357,7 +358,7 @@ export type RESTDeleteAPIGuildResult = never; /** * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels} */ -export type RESTGetAPIGuildChannelsResult = APIChannel[]; +export type RESTGetAPIGuildChannelsResult = APIGuildChannel[]; /** * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel} diff --git a/tests/v10/channel.ts b/tests/v10/channel.ts index 8a96b6ea..2525d894 100644 --- a/tests/v10/channel.ts +++ b/tests/v10/channel.ts @@ -1,5 +1,5 @@ import type { - ChannelType, + GuildChannelType, APIPartialChannel, APIGroupDMChannel, APIDMChannel, @@ -11,7 +11,7 @@ import type { } from '../../v10'; import { expectAssignable, expectNotAssignable } from '../__utils__/type-assertions'; -type AnyGuildChannel = APIGuildChannel; +type AnyGuildChannel = APIGuildChannel; declare const partialChannel: APIPartialChannel; declare const dmChannel: APIDMChannel;