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

Improves StartedStoppedHandler definition to return Promise with void[] #1173

Merged
merged 1 commit into from Jan 2, 2023

Conversation

danieledraganti
Copy link
Contributor

@danieledraganti danieledraganti commented Dec 28, 2022

When using TypeScript, the started, created and stopped methods in services (and for extension, middleware) are supposed to be able to return any kind of Promise, but the current type definition breaks in case a Promise.all is returned. This PR fixes it by adding a Promise<void[]> return type.

  • Bug fix (non-breaking change which fixes an issue)

🚦 How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Applied the change to index.d.ts and then checked type definition in a middleware (extending ServiceSchema). Linter did not return any error while testing created() {return Promise.all(promises)}.

🏁 Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@icebob icebob merged commit 8c8d6d6 into moleculerjs:master Jan 2, 2023
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

2 participants