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

View File

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