From 0cd54399efb561ef6fc644a799789d76f37d03c3 Mon Sep 17 00:00:00 2001 From: almeidx Date: Mon, 28 Nov 2022 09:29:25 +0000 Subject: [PATCH] fix: remove casts when using `makeURLSearchParams()` --- packages/core/src/api/applicationCommands.ts | 4 ++-- packages/core/src/api/channel.ts | 8 ++++---- packages/core/src/api/guild.ts | 14 +++++++------- packages/core/src/api/invite.ts | 2 +- packages/core/src/api/user.ts | 2 +- packages/core/src/api/webhook.ts | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/core/src/api/applicationCommands.ts b/packages/core/src/api/applicationCommands.ts index 1f66c1a45711..50f61dbf11ba 100644 --- a/packages/core/src/api/applicationCommands.ts +++ b/packages/core/src/api/applicationCommands.ts @@ -29,7 +29,7 @@ export class ApplicationCommandsAPI { */ public async getGlobalCommands(applicationId: Snowflake, options: RESTGetAPIApplicationCommandsQuery = {}) { return this.rest.get(Routes.applicationCommands(applicationId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -109,7 +109,7 @@ export class ApplicationCommandsAPI { data: RESTGetAPIApplicationGuildCommandsQuery = {}, ) { return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), { - query: makeURLSearchParams(data as Record), + query: makeURLSearchParams(data), }) as Promise; } diff --git a/packages/core/src/api/channel.ts b/packages/core/src/api/channel.ts index ea1b125884af..de87dcc375d2 100644 --- a/packages/core/src/api/channel.ts +++ b/packages/core/src/api/channel.ts @@ -76,7 +76,7 @@ export class ChannelsAPI { options: RESTGetAPIChannelMessageReactionUsersQuery = {}, ) { return this.rest.get(Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -171,7 +171,7 @@ export class ChannelsAPI { */ public async getMessages(channelId: Snowflake, options: RESTGetAPIChannelMessagesQuery = {}) { return this.rest.get(Routes.channelMessages(channelId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -305,7 +305,7 @@ export class ChannelsAPI { options: RESTGetAPIChannelThreadsArchivedQuery = {}, ) { return this.rest.get(Routes.channelThreads(channelId, archivedStatus), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -320,7 +320,7 @@ export class ChannelsAPI { options: RESTGetAPIChannelThreadsArchivedQuery = {}, ) { return this.rest.get(Routes.channelJoinedArchivedThreads(channelId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } } diff --git a/packages/core/src/api/guild.ts b/packages/core/src/api/guild.ts index 609e9b13b8d4..c4a93c552b83 100644 --- a/packages/core/src/api/guild.ts +++ b/packages/core/src/api/guild.ts @@ -144,7 +144,7 @@ export class GuildsAPI { */ public async getMembers(guildId: Snowflake, options: RESTGetAPIGuildMembersQuery = {}) { return this.rest.get(Routes.guildMembers(guildId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -314,7 +314,7 @@ export class GuildsAPI { */ public async getPruneCount(guildId: Snowflake, options: RESTGetAPIGuildPruneCountQuery = {}) { return this.rest.get(Routes.guildPrune(guildId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -535,7 +535,7 @@ export class GuildsAPI { */ public async getScheduledEvents(guildId: Snowflake, options: RESTGetAPIGuildScheduledEventsQuery = {}) { return this.rest.get(Routes.guildScheduledEvents(guildId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -566,7 +566,7 @@ export class GuildsAPI { options: RESTGetAPIGuildScheduledEventQuery = {}, ) { return this.rest.get(Routes.guildScheduledEvent(guildId, eventId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -614,7 +614,7 @@ export class GuildsAPI { options: RESTGetAPIGuildScheduledEventUsersQuery = {}, ) { return this.rest.get(Routes.guildScheduledEventUsers(guildId, eventId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -740,7 +740,7 @@ export class GuildsAPI { */ public async getAuditLogs(guildId: Snowflake, options: RESTGetAPIAuditLogQuery = {}) { return this.rest.get(Routes.guildAuditLog(guildId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } @@ -832,7 +832,7 @@ export class GuildsAPI { */ public async searchForMembers(guildId: Snowflake, options: RESTGetAPIGuildMembersSearchQuery) { return this.rest.get(Routes.guildMembersSearch(guildId), { - query: makeURLSearchParams(options as unknown as Record), + query: makeURLSearchParams(options), }) as Promise; } diff --git a/packages/core/src/api/invite.ts b/packages/core/src/api/invite.ts index 44da9150685e..b5fe6d0d6de3 100644 --- a/packages/core/src/api/invite.ts +++ b/packages/core/src/api/invite.ts @@ -11,7 +11,7 @@ export class InvitesAPI { */ public async get(code: string, options: RESTGetAPIInviteQuery = {}) { return this.rest.get(Routes.invite(code), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } diff --git a/packages/core/src/api/user.ts b/packages/core/src/api/user.ts index 5f03bb1b49fc..50b3dddf13e9 100644 --- a/packages/core/src/api/user.ts +++ b/packages/core/src/api/user.ts @@ -42,7 +42,7 @@ export class UsersAPI { */ public async getGuilds(options: RESTGetAPICurrentUserGuildsQuery = {}) { return this.rest.get(Routes.userGuilds(), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), }) as Promise; } diff --git a/packages/core/src/api/webhook.ts b/packages/core/src/api/webhook.ts index b4da4997d649..52c3d2607c72 100644 --- a/packages/core/src/api/webhook.ts +++ b/packages/core/src/api/webhook.ts @@ -135,7 +135,7 @@ export class WebhooksAPI { options: RESTPostAPIWebhookWithTokenSlackQuery = {}, ) { await this.rest.post(Routes.webhookPlatform(id, token, 'slack'), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), body, auth: false, }); @@ -155,7 +155,7 @@ export class WebhooksAPI { options: RESTPostAPIWebhookWithTokenGitHubQuery = {}, ) { await this.rest.post(Routes.webhookPlatform(id, token, 'github'), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), body, auth: false, }); @@ -171,7 +171,7 @@ export class WebhooksAPI { */ public async getMessage(id: Snowflake, token: string, messageId: Snowflake, options: { thread_id?: string } = {}) { return this.rest.get(Routes.webhookMessage(id, token, messageId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), auth: false, }) as Promise; } @@ -207,7 +207,7 @@ export class WebhooksAPI { */ public async deleteMessage(id: Snowflake, token: string, messageId: Snowflake, options: { thread_id?: string } = {}) { await this.rest.delete(Routes.webhookMessage(id, token, messageId), { - query: makeURLSearchParams(options as Record), + query: makeURLSearchParams(options), auth: false, }); }