-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(Typings): type attachments to InteractionUpdateOptions #6162
Conversation
const attachments: MessageAttachment[] = [];
msg.edit({ attachments, content: 'abc' }); This works without using TS ignore... |
If that works then logically speaking I would expect |
Co-authored-by: DTrombett <73136330+DTrombett@users.noreply.github.com>
Also, this error also pops up when using |
I can't replicate any issue with |
Odd. I also get this error when trying to update a MesaageComponentInteraction with no attachments. |
InteractionUpdateOptions > InteractionReplyOptions > WebhookMessageOptions > MessageOptions This isn't quite what it should be; export interface InteractionUpdateOptions extends Omit<WebhookEditMessageOptions, 'username' | 'avatarURL'> {
fetchReply?: boolean;
} and export interface WebhookEditMessageOptions extends Pick<
WebhookMessageOptions,
'content' | 'embeds' | 'files' | 'allowedMentions' | 'components'
> {
attachments: MessageAttachment[];
} Or just scrap picking from |
Picking from MessageOptions makes more sense. I'll try to implement a fix. |
From what you said, this implies that when you are assigning |
You're referring to an error I was unable to replicate on For comparison, you can also remove |
So all this has to do is type |
I think so, yes. But as its a long chain of Omits as you pointed out, finding the right place/editing that chain is the tricky part. Otherwise if you are running into the issue on |
Yea, I think it was something to do with Yarn's PnP and my workspace typescript version, that one seems to of been fixed, this PR should now focus on fixing |
Anything else need to be changed? |
Please describe the changes this PR makes and why it should be merged:
Currently, if you want to remove attachments from a message you have to use
message.removeAttachments()
, and if you need to edit the content as well that is 2 API calls. Assigningattachments: []
does work, but sparks errors in TypeScript that require// @ts-ignore
- which is generally considered a bad practice. This PR fixes the typings allowing you to assignattachments: []
without having to use ts-ignore.Status and versioning classification:
I know how to update typings and have done so, or typings don't need updating