types: fix some attachment related typings (#8013)

This commit is contained in:
Parbez
2022-06-06 02:07:56 +05:30
committed by GitHub
parent 6266b0c1e3
commit 6aa623240e
2 changed files with 8 additions and 7 deletions

View File

@@ -3971,7 +3971,7 @@ export interface CommandInteractionOption<Cached extends CacheType = CacheType>
member?: CacheTypeReducer<Cached, GuildMember, APIInteractionDataResolvedGuildMember>;
channel?: CacheTypeReducer<Cached, GuildBasedChannel, APIInteractionDataResolvedChannel>;
role?: CacheTypeReducer<Cached, Role, APIRole>;
attachment?: AttachmentBuilder;
attachment?: Attachment;
message?: Message<BooleanCache<Cached>>;
}
@@ -3981,7 +3981,7 @@ export interface CommandInteractionResolvedData<Cached extends CacheType = Cache
roles?: Collection<Snowflake, CacheTypeReducer<Cached, Role, APIRole>>;
channels?: Collection<Snowflake, CacheTypeReducer<Cached, AnyChannel, APIInteractionDataResolvedChannel>>;
messages?: Collection<Snowflake, CacheTypeReducer<Cached, Message, APIMessage>>;
attachments?: Collection<Snowflake, AttachmentBuilder>;
attachments?: Collection<Snowflake, Attachment>;
}
export declare const Colors: {
@@ -4707,7 +4707,7 @@ export interface MessageEditOptions {
attachments?: JSONEncodable<AttachmentPayload>[];
content?: string | null;
embeds?: (JSONEncodable<APIEmbed> | APIEmbed)[] | null;
files?: (AttachmentPayload | BufferResolvable | Stream | AttachmentBuilder)[];
files?: (BufferResolvable | Stream | JSONEncodable<APIAttachment> | Attachment | AttachmentBuilder)[];
flags?: BitFieldResolvable<MessageFlagsString, number>;
allowedMentions?: MessageMentionOptions;
components?: (
@@ -4758,10 +4758,10 @@ export interface MessageOptions {
| APIActionRowComponent<APIMessageActionRowComponent>
)[];
allowedMentions?: MessageMentionOptions;
files?: (Attachment | AttachmentBuilder | BufferResolvable | Stream)[];
files?: (BufferResolvable | Stream | JSONEncodable<APIAttachment> | Attachment | AttachmentBuilder)[];
reply?: ReplyOptions;
stickers?: StickerResolvable[];
attachments?: (Attachment | AttachmentBuilder)[];
attachments?: JSONEncodable<AttachmentPayload>[];
flags?: BitFieldResolvable<Extract<MessageFlagsString, 'SuppressEmbeds'>, number>;
}

View File

@@ -122,6 +122,7 @@ import {
ChannelMention,
UserMention,
PartialGroupDMChannel,
Attachment,
} from '.';
import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd';
import { UnsafeButtonBuilder, UnsafeEmbedBuilder, UnsafeSelectMenuBuilder } from '@discordjs/builders';
@@ -1491,8 +1492,8 @@ expectNotAssignable<ActionRowData<MessageActionRowComponentData>>({
declare const chatInputInteraction: ChatInputCommandInteraction;
expectType<AttachmentBuilder>(chatInputInteraction.options.getAttachment('attachment', true));
expectType<AttachmentBuilder | null>(chatInputInteraction.options.getAttachment('attachment'));
expectType<Attachment>(chatInputInteraction.options.getAttachment('attachment', true));
expectType<Attachment | null>(chatInputInteraction.options.getAttachment('attachment'));
declare const modal: ModalBuilder;