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

Fix .description(): do not set command description if undefined is provided in the first parameter #1966

Closed

Conversation

aweebit
Copy link
Contributor

@aweebit aweebit commented Aug 13, 2023

This is a ridiculously unimportant change, but it fixes one of the errors revealed by a run of the TypeScript check fixed in #1960.

I've learnt my lesson, and since the change is technically visible to the outside world, I am making a separate PR for it.

Peer PRs

Changes are to be merged into…

@@ -1837,7 +1837,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
*/
description(str, argsDescription) {
if (str === undefined && argsDescription === undefined) return this._description;
Copy link
Contributor Author

@aweebit aweebit Aug 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative solution not allowing to change only the arguments description:

Suggested change
if (str === undefined && argsDescription === undefined) return this._description;
if (str === undefined) return this._description;

(and leave the next line untouched)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually like this alternative solution better, and argsDescription is deprecated. But it would technically be a breaking change. I think simpler just to leave it alone (and one day get rid of argsDescription).

@aweebit aweebit mentioned this pull request Aug 13, 2023
@shadowspawn
Copy link
Collaborator

Can revisit this if/when it gets in the way of adding more strict checks to the JavaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants