refactor(GatewayGuildCreateDispatchData): Narrow channels and threads types (#1146)

* refactor: narrow guild create types

* refactor: use `GuildChannelType` and `ThreadChannelType`
This commit is contained in:
Jiralite
2024-11-19 12:49:25 +00:00
committed by GitHub
parent 999e48fae0
commit f5ebb2088b
4 changed files with 16 additions and 8 deletions

View File

@@ -37,6 +37,8 @@ import type {
ChannelType,
APISubscription,
APISoundboardSound,
GuildChannelType,
ThreadChannelType,
} from '../payloads/v10/mod.ts';
import type { ReactionType } from '../rest/v10/mod.ts';
import type { Nullable } from '../utils/internals.ts';
@@ -879,7 +881,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channels: APIChannel[];
channels: (APIChannel & { type: Exclude<GuildChannelType, ThreadChannelType> })[];
/**
* Threads in the guild
*
@@ -887,7 +889,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
threads: (APIChannel & { type: ThreadChannelType })[];
/**
* Presences of the members in the guild, will only include non-offline members if the size is greater than `large_threshold`
*

View File

@@ -36,6 +36,8 @@ import type {
ChannelType,
APISubscription,
APISoundboardSound,
GuildChannelType,
ThreadChannelType,
} from '../payloads/v9/mod.ts';
import type { ReactionType } from '../rest/v9/mod.ts';
import type { Nullable } from '../utils/internals.ts';
@@ -878,7 +880,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channels: APIChannel[];
channels: (APIChannel & { type: Exclude<GuildChannelType, ThreadChannelType> })[];
/**
* Threads in the guild
*
@@ -886,7 +888,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
threads: (APIChannel & { type: ThreadChannelType })[];
/**
* Presences of the members in the guild, will only include non-offline members if the size is greater than `large_threshold`
*

View File

@@ -37,6 +37,8 @@ import type {
ChannelType,
APISubscription,
APISoundboardSound,
GuildChannelType,
ThreadChannelType,
} from '../payloads/v10/index';
import type { ReactionType } from '../rest/v10/index';
import type { Nullable } from '../utils/internals';
@@ -879,7 +881,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channels: APIChannel[];
channels: (APIChannel & { type: Exclude<GuildChannelType, ThreadChannelType> })[];
/**
* Threads in the guild
*
@@ -887,7 +889,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
threads: (APIChannel & { type: ThreadChannelType })[];
/**
* Presences of the members in the guild, will only include non-offline members if the size is greater than `large_threshold`
*

View File

@@ -36,6 +36,8 @@ import type {
ChannelType,
APISubscription,
APISoundboardSound,
GuildChannelType,
ThreadChannelType,
} from '../payloads/v9/index';
import type { ReactionType } from '../rest/v9/index';
import type { Nullable } from '../utils/internals';
@@ -878,7 +880,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channels: APIChannel[];
channels: (APIChannel & { type: Exclude<GuildChannelType, ThreadChannelType> })[];
/**
* Threads in the guild
*
@@ -886,7 +888,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
threads: (APIChannel & { type: ThreadChannelType })[];
/**
* Presences of the members in the guild, will only include non-offline members if the size is greater than `large_threshold`
*