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(Types): make event listeners accept async callbacks #5602

Conversation

kyranet
Copy link
Member

@kyranet kyranet commented May 9, 2021

Please describe the changes this PR makes and why it should be merged:

When using client.on with a callback that returns a Promise, eslint will then complain if the no-misused-promises (from @typescript-eslint and various plugins) is enabled, as Promise<?> does not match void.

By making the return type of the callbacks unknown, we can now return any data, including promises.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR only includes non-code changes, like changes to documentation, README, etc.

Copy link
Member

@vladfrangu vladfrangu left a comment

Choose a reason for hiding this comment

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

I dunno... the type would be void | Promise<void> at best... I'm personally fine with this, but I don't know what the rest of the team thinks

@kyranet kyranet changed the title fix(Types): make event listeners accept unknown-returned cb fix(Types): make event listeners accept async callbacks May 9, 2021
@iCrawl iCrawl merged commit a73a5cf into discordjs:master May 29, 2021
@iCrawl iCrawl added this to the Version 13 milestone Jun 27, 2021
@kyranet kyranet deleted the fix/make-event-extensions-accept-unknown-return-callbacks branch July 5, 2021 12:56
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.

None yet

5 participants