Skip to content

Commit 790b4de

Browse files
authored
refactor: improved channel types (#1397)
1 parent 51b2d4e commit 790b4de

File tree

9 files changed

+18
-14
lines changed

9 files changed

+18
-14
lines changed

deno/payloads/v10/channel.ts

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deno/payloads/v9/channel.ts

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deno/rest/v10/guild.ts

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deno/rest/v9/guild.ts

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

payloads/v10/channel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export interface APIPinChannel<T extends ChannelType> extends APIChannelBase<T>
110110
last_pin_timestamp?: string | null;
111111
}
112112

113-
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
113+
export interface APIGuildChannel<T extends GuildChannelType = GuildChannelType> extends APIChannelBase<T> {
114114
/**
115115
* The name of the channel (1-100 characters)
116116
*/
@@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.Gui
163163
parent_id?: null;
164164
}
165165

166-
export interface APIVoiceChannelBase<T extends ChannelType>
166+
export interface APIVoiceChannelBase<T extends GuildChannelType>
167167
extends APIGuildChannel<T>,
168168
APISortableChannel,
169169
APITextBasedChannel<T>,

payloads/v9/channel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export interface APIPinChannel<T extends ChannelType> extends APIChannelBase<T>
110110
last_pin_timestamp?: string | null;
111111
}
112112

113-
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
113+
export interface APIGuildChannel<T extends GuildChannelType = GuildChannelType> extends APIChannelBase<T> {
114114
/**
115115
* The name of the channel (1-100 characters)
116116
*/
@@ -163,7 +163,7 @@ export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.Gui
163163
parent_id?: null;
164164
}
165165

166-
export interface APIVoiceChannelBase<T extends ChannelType>
166+
export interface APIVoiceChannelBase<T extends GuildChannelType = GuildChannelType>
167167
extends APIGuildChannel<T>,
168168
APISortableChannel,
169169
APITextBasedChannel<T>,

rest/v10/guild.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import type {
2828
APIGuildOnboardingPromptOption,
2929
APIRoleColors,
3030
APIIncidentsData,
31+
APIGuildChannel,
3132
} from '../../payloads/v10/index';
3233
import type {
3334
_AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
@@ -357,7 +358,7 @@ export type RESTDeleteAPIGuildResult = never;
357358
/**
358359
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels}
359360
*/
360-
export type RESTGetAPIGuildChannelsResult = APIChannel[];
361+
export type RESTGetAPIGuildChannelsResult = APIGuildChannel[];
361362

362363
/**
363364
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel}

rest/v9/guild.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import type {
2828
APIGuildOnboardingPromptOption,
2929
APIRoleColors,
3030
APIIncidentsData,
31+
APIGuildChannel,
3132
} from '../../payloads/v9/index';
3233
import type {
3334
_AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
@@ -357,7 +358,7 @@ export type RESTDeleteAPIGuildResult = never;
357358
/**
358359
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels}
359360
*/
360-
export type RESTGetAPIGuildChannelsResult = APIChannel[];
361+
export type RESTGetAPIGuildChannelsResult = APIGuildChannel[];
361362

362363
/**
363364
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel}

tests/v10/channel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {
2-
ChannelType,
2+
GuildChannelType,
33
APIPartialChannel,
44
APIGroupDMChannel,
55
APIDMChannel,
@@ -11,7 +11,7 @@ import type {
1111
} from '../../v10';
1212
import { expectAssignable, expectNotAssignable } from '../__utils__/type-assertions';
1313

14-
type AnyGuildChannel = APIGuildChannel<ChannelType>;
14+
type AnyGuildChannel = APIGuildChannel<GuildChannelType>;
1515

1616
declare const partialChannel: APIPartialChannel;
1717
declare const dmChannel: APIDMChannel;

0 commit comments

Comments
 (0)