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

feat: mark action as explicitly accepting promises #33

Merged
merged 1 commit into from
Feb 20, 2023
Merged

feat: mark action as explicitly accepting promises #33

merged 1 commit into from
Feb 20, 2023

Conversation

AviVahl
Copy link
Contributor

@AviVahl AviVahl commented Feb 19, 2023

while typescript allows passing in () => Promise<void> as a callback for () => void, typescript-eslint catches those as Promise returned in function argument where a void return was expected.eslint@typescript-eslint/no-misused-promises (in its type-checking rules)

this change allows passing in async functions to action(), knowing the returned promise by parseAsync() will be handled by the caller.

while typescript allows passing in `() => Promise<void>` as a callback for `() => void`, typescript-eslint catches those as `Promise returned in function argument where a void return was expected.eslint@typescript-eslint/no-misused-promises` (in its type-checking rules)

this change allows passing in async functions to `action()`, knowing the returned promise by `parseAsync()` will be handled by the caller.
@shadowspawn shadowspawn changed the base branch from main to develop February 19, 2023 19:13
@shadowspawn
Copy link
Contributor

I expected this would get applied to Commander too, but it is already there: https://github.com/tj/commander.js/blob/8b03ab75b5431fd2d58a24b842ba088d621f12dc/typings/index.d.ts#L498

The Promise was likely accidentally omitted when working on the type inferences.

Copy link
Contributor

@shadowspawn shadowspawn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

Copy link
Contributor

@abetomo abetomo left a comment

Choose a reason for hiding this comment

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

Thanks!

@abetomo abetomo merged commit 3fad90f into commander-js:develop Feb 20, 2023
@shadowspawn shadowspawn added the pending release On a branch for eventual release, but not yet merged to main. label Feb 20, 2023
@shadowspawn shadowspawn removed the pending release On a branch for eventual release, but not yet merged to main. label Mar 3, 2023
@shadowspawn
Copy link
Contributor

Released in v10.0.3

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.

3 participants