refactor: improved channel types (#1397)

This commit is contained in:
Denis-Adrian Cristea
2025-10-13 12:26:03 +03:00
committed by GitHub
parent 51b2d4e1c9
commit 790b4deb0f
9 changed files with 18 additions and 14 deletions

View File

@@ -110,7 +110,7 @@ export interface APIPinChannel<T extends ChannelType> extends APIChannelBase<T>
last_pin_timestamp?: string | null;
}
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
export interface APIGuildChannel<T extends GuildChannelType = GuildChannelType> extends APIChannelBase<T> {
/**
* The name of the channel (1-100 characters)
*/
@@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.Gui
parent_id?: null;
}
export interface APIVoiceChannelBase<T extends ChannelType>
export interface APIVoiceChannelBase<T extends GuildChannelType>
extends APIGuildChannel<T>,
APISortableChannel,
APITextBasedChannel<T>,

View File

@@ -110,7 +110,7 @@ export interface APIPinChannel<T extends ChannelType> extends APIChannelBase<T>
last_pin_timestamp?: string | null;
}
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
export interface APIGuildChannel<T extends GuildChannelType = GuildChannelType> extends APIChannelBase<T> {
/**
* The name of the channel (1-100 characters)
*/
@@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.Gui
parent_id?: null;
}
export interface APIVoiceChannelBase<T extends ChannelType>
export interface APIVoiceChannelBase<T extends GuildChannelType = GuildChannelType>
extends APIGuildChannel<T>,
APISortableChannel,
APITextBasedChannel<T>,

View File

@@ -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}

3
deno/rest/v9/guild.ts generated
View File

@@ -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}

View File

@@ -110,7 +110,7 @@ export interface APIPinChannel<T extends ChannelType> extends APIChannelBase<T>
last_pin_timestamp?: string | null;
}
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
export interface APIGuildChannel<T extends GuildChannelType = GuildChannelType> extends APIChannelBase<T> {
/**
* The name of the channel (1-100 characters)
*/
@@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.Gui
parent_id?: null;
}
export interface APIVoiceChannelBase<T extends ChannelType>
export interface APIVoiceChannelBase<T extends GuildChannelType>
extends APIGuildChannel<T>,
APISortableChannel,
APITextBasedChannel<T>,

View File

@@ -110,7 +110,7 @@ export interface APIPinChannel<T extends ChannelType> extends APIChannelBase<T>
last_pin_timestamp?: string | null;
}
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
export interface APIGuildChannel<T extends GuildChannelType = GuildChannelType> extends APIChannelBase<T> {
/**
* The name of the channel (1-100 characters)
*/
@@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.Gui
parent_id?: null;
}
export interface APIVoiceChannelBase<T extends ChannelType>
export interface APIVoiceChannelBase<T extends GuildChannelType = GuildChannelType>
extends APIGuildChannel<T>,
APISortableChannel,
APITextBasedChannel<T>,

View File

@@ -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}

View File

@@ -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}

View File

@@ -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<ChannelType>;
type AnyGuildChannel = APIGuildChannel<GuildChannelType>;
declare const partialChannel: APIPartialChannel;
declare const dmChannel: APIDMChannel;