Skip to content
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

AttachmentBuilder's data parameter may be of the wrong documented type #8407

Closed
Jiralite opened this issue Jul 31, 2022 · 0 comments · Fixed by #8421
Closed

AttachmentBuilder's data parameter may be of the wrong documented type #8407

Jiralite opened this issue Jul 31, 2022 · 0 comments · Fixed by #8421

Comments

@Jiralite
Copy link
Member

Which package is this bug report for?

discord.js

Issue description

The AttachmentBuilder's second parameter in the constructor is an APIAttachment which seems to document 10 properties currently. However, as seen here:

/**
* @param {BufferResolvable|Stream} attachment The file
* @param {APIAttachment} [data] Extra data
*/
constructor(attachment, data = {}) {
/**
* The file associated with this attachment.
* @type {BufferResolvable|Stream}
*/
this.attachment = attachment;
/**
* The name of this attachment
* @type {?string}
*/
this.name = data.name;
/**
* The description of the attachment
* @type {?string}
*/
this.description = data.description;
}

Only 1 seems to be used which is description (and filename seems to be name here). This doesn't look correct.

In the typings, however:

public constructor(attachment: BufferResolvable | Stream, data?: AttachmentData);

export interface AttachmentData {
name?: string;
description?: string;
}

This seems to be typed correctly. The documentation is very likely outdated.

Code sample

No response

Package version

14.1.3-dev

Node.js version

Node.js 16.14.0; TypeScript 4.7.4

Operating system

macOS Monterey 12.4

Priority this issue should have

Low (slightly annoying)

Which partials do you have configured?

Not applicable (subpackage bug)

Which gateway intents are you subscribing to?

Not applicable (subpackage bug)

I have tested this issue on a development release

4d8361c

RedGuy12 added a commit to RedGuy12/discord.js that referenced this issue Aug 3, 2022
@Jiralite Jiralite added the has PR label Aug 5, 2022
@iCrawl iCrawl closed this as completed in 5b053cf Aug 8, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant