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

Types for getSubcommand are wrong #10641

Closed
abbytec opened this issue Dec 8, 2024 · 2 comments
Closed

Types for getSubcommand are wrong #10641

abbytec opened this issue Dec 8, 2024 · 2 comments

Comments

@abbytec
Copy link

abbytec commented Dec 8, 2024

Which package is this bug report for?

discord.js

Issue description

On typescript, if you use chatInputCommandInteraction.options.getSubcommand(true) you expect to receive a string, otherwise you expect to receive a string or null. But it is defined as follows:
public getSubcommand(required?: true): string;
public getSubcommand(required: boolean): string | null;

it should look like this (as the other getUser/getChannel/etc methods do):
public getSubcommand(required: true): string;
public getSubcommand(required?: boolean): string | null;

Code sample

No response

Versions

Discordjs 14.16.3
Node v18.17.1
Typescript 9.6.7

Issue priority

Low (slightly annoying)

Which partials do you have configured?

Not applicable

Which gateway intents are you subscribing to?

Not applicable

I have tested this issue on a development release

No response

@abbytec
Copy link
Author

abbytec commented Dec 8, 2024

public getSubcommand(required?: true): string;

@Jiralite
Copy link
Member

Jiralite commented Dec 8, 2024

On typescript, if you use chatInputCommandInteraction.options.getSubcommand(true) you expect to receive a string, otherwise you expect to receive a string or null. But it is defined as follows:
public getSubcommand(required?: true): string;
public getSubcommand(required: boolean): string | null;

This is correct. If the parameter is missing or is true, it will return a string, otherwise string | null.

it should look like this (as the other getUser/getChannel/etc methods do):
public getSubcommand(required: true): string;
public getSubcommand(required?: boolean): string | null;

This does not reflect JavaScript, so this would be incorrect.


There is no issue.

@Jiralite Jiralite closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2024
@Jiralite Jiralite added invalid and removed bug labels Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants