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

missing/wrong typings for thread auto archive duration #7814

Closed
Kneemund opened this issue Apr 18, 2022 · 2 comments · Fixed by #7816
Closed

missing/wrong typings for thread auto archive duration #7814

Kneemund opened this issue Apr 18, 2022 · 2 comments · Fixed by #7816

Comments

@Kneemund
Copy link

Which package is this bug report for?

discord.js

Issue description

When creating (editing) a thread, the autoArchiveDuration field of StartThreadOptions (ThreadEditData) should accept 60 | 1440 | 4320 | 10080 | 'MAX' according to the current documentation. However, the current type of the field (ThreadAutoArchiveDuration) only expands to 60 | 1440 | 4320 | 10080. 'MAX' is missing. It should be added to the fields as a separate type, not to ThreadAutoArchiveDuration. The 'MAX' option in the current documentation should be moved from ThreadAutoArchiveDuration to the individual fields.

Additionally, Util.resolveAutoArchiveMaxLimit currently has a return type of number, which prevents it from being assigned to ThreadAutoArchiveDuration unless you do unnecessary type checks. The return type should be changed to ThreadAutoArchiveDuration.

If you decide to leave the typings as they are in the current documentation (i.e. include 'MAX' in ThreadAutoArchiveDuration), then you should add a separate type for Util.resolveAutoArchiveMaxLimit which doesn't include 'MAX'.

Code sample

No response

Package version

discord.js@14.0.0-dev.1650240532-9ef7ffd

Node.js version

v17.9.0 (typescript@4.6.3)

Operating system

No response

Priority this issue should have

Medium (should be fixed soon)

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

9ef7ffd

@MarcusOtter
Copy link
Contributor

MarcusOtter commented May 15, 2022

Getting this problem in 13.7.0, the "MAX" option has disappeared.
image

But it still exists in the docs for 13.7.0:
image

Is the plan to release this fix for 14.0.0? Should the docs be updated for this version?

Edit: I slightly misunderstood the issue. I understand now that "MAX" should not be added to ThreadAutoArchiveDuration, but it would still be good if the docs confirmed that.

@Jiralite
Copy link
Member

Edit: I slightly misunderstood the issue. I understand now that "MAX" should not be added to ThreadAutoArchiveDuration, but it would still be good if the docs confirmed that.

There is no point - the MAX option will disappear in the next major version as its use is obsolete.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 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.

4 participants