From 395a68ff49c622d5136d6b775beaf8e88a2d8610 Mon Sep 17 00:00:00 2001 From: Khafra <42794878+KhafraDev@users.noreply.github.com> Date: Thu, 17 Feb 2022 11:45:42 -0500 Subject: [PATCH] fix: attachment types (#7478) --- packages/discord.js/typings/index.d.ts | 7 ++++++- packages/discord.js/typings/index.test-d.ts | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 65f894503..8da3b22b6 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -810,6 +810,11 @@ export class CommandInteractionOptionResolver['member']> | null; public getRole(name: string, required: true): NonNullable['role']>; public getRole(name: string, required?: boolean): NonNullable['role']> | null; + public getAttachment(name: string, required: true): NonNullable['attachment']>; + public getAttachment( + name: string, + required?: boolean, + ): NonNullable['attachment']> | null; public getMentionable( name: string, required: true, @@ -3719,7 +3724,7 @@ export interface CommandInteractionOption member?: CacheTypeReducer; channel?: CacheTypeReducer; role?: CacheTypeReducer; - attachment?: Collection; + attachment?: MessageAttachment; message?: GuildCacheMessage; } diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index db55b6284..2bfead7e6 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -1307,3 +1307,8 @@ const selectMenu = new SelectMenuComponent({ new ActionRow({ components: [selectMenu.toJSON(), button.toJSON()], }); + +declare const chatInputInteraction: ChatInputCommandInteraction; + +expectType(chatInputInteraction.options.getAttachment('attachment', true)); +expectType(chatInputInteraction.options.getAttachment('attachment'));