refactor: narrow channel gateway events types (#1148)

This commit is contained in:
Jiralite
2024-11-22 06:03:01 +00:00
committed by GitHub
parent 029002b171
commit 8659ac8b8d
4 changed files with 20 additions and 8 deletions

View File

@@ -707,7 +707,10 @@ export type GatewayChannelModifyDispatch = DataPayload<
* https://discord.com/developers/docs/topics/gateway-events#channel-update
* https://discord.com/developers/docs/topics/gateway-events#channel-delete
*/
export type GatewayChannelModifyDispatchData = APIChannel;
export type GatewayChannelModifyDispatchData = APIChannel & {
type: Exclude<GuildChannelType, ThreadChannelType>;
guild_id: Snowflake;
};
/**
* https://discord.com/developers/docs/topics/gateway-events#channel-create
@@ -1838,7 +1841,7 @@ export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id
*/
export type GatewayThreadModifyDispatch = DataPayload<
GatewayDispatchEvents.ThreadCreate | GatewayDispatchEvents.ThreadDelete | GatewayDispatchEvents.ThreadUpdate,
GatewayChannelModifyDispatchData
APIThreadChannel
>;
/**

View File

@@ -706,7 +706,10 @@ export type GatewayChannelModifyDispatch = DataPayload<
* https://discord.com/developers/docs/topics/gateway-events#channel-update
* https://discord.com/developers/docs/topics/gateway-events#channel-delete
*/
export type GatewayChannelModifyDispatchData = APIChannel;
export type GatewayChannelModifyDispatchData = APIChannel & {
type: Exclude<GuildChannelType, ThreadChannelType>;
guild_id: Snowflake;
};
/**
* https://discord.com/developers/docs/topics/gateway-events#channel-create
@@ -1837,7 +1840,7 @@ export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id
*/
export type GatewayThreadModifyDispatch = DataPayload<
GatewayDispatchEvents.ThreadCreate | GatewayDispatchEvents.ThreadDelete | GatewayDispatchEvents.ThreadUpdate,
GatewayChannelModifyDispatchData
APIThreadChannel
>;
/**

View File

@@ -707,7 +707,10 @@ export type GatewayChannelModifyDispatch = DataPayload<
* https://discord.com/developers/docs/topics/gateway-events#channel-update
* https://discord.com/developers/docs/topics/gateway-events#channel-delete
*/
export type GatewayChannelModifyDispatchData = APIChannel;
export type GatewayChannelModifyDispatchData = APIChannel & {
type: Exclude<GuildChannelType, ThreadChannelType>;
guild_id: Snowflake;
};
/**
* https://discord.com/developers/docs/topics/gateway-events#channel-create
@@ -1838,7 +1841,7 @@ export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id
*/
export type GatewayThreadModifyDispatch = DataPayload<
GatewayDispatchEvents.ThreadCreate | GatewayDispatchEvents.ThreadDelete | GatewayDispatchEvents.ThreadUpdate,
GatewayChannelModifyDispatchData
APIThreadChannel
>;
/**

View File

@@ -706,7 +706,10 @@ export type GatewayChannelModifyDispatch = DataPayload<
* https://discord.com/developers/docs/topics/gateway-events#channel-update
* https://discord.com/developers/docs/topics/gateway-events#channel-delete
*/
export type GatewayChannelModifyDispatchData = APIChannel;
export type GatewayChannelModifyDispatchData = APIChannel & {
type: Exclude<GuildChannelType, ThreadChannelType>;
guild_id: Snowflake;
};
/**
* https://discord.com/developers/docs/topics/gateway-events#channel-create
@@ -1837,7 +1840,7 @@ export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id
*/
export type GatewayThreadModifyDispatch = DataPayload<
GatewayDispatchEvents.ThreadCreate | GatewayDispatchEvents.ThreadDelete | GatewayDispatchEvents.ThreadUpdate,
GatewayChannelModifyDispatchData
APIThreadChannel
>;
/**