moleculer
moleculer copied to clipboard
feat: Expand the type for ServiceSchema to allow for typed lifecycle handlers
This change expands the typings for the ServiceSchema, allowing it to accept the "service-this" type used by the lifecycle handlers in the typescript template. Please see this issue for a more complete explanation.
:memo: Description
Change the type of the ServiceSchema to accept two generic types, latter of which is new and used to provide types for the lifecycle methods (created, started, stopped).
The typescript template will require a minor change if this change is accepted.
:dart: Relevant issues
moleculer-template-project-typescript #70
:gem: Type of change
- [x] New feature (non-breaking change which adds functionality)
:vertical_traffic_light: How Has This Been Tested?
The example code to verify that this change works is outlined in moleculer-template-project-typescript #70.
:checkered_flag: Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [x] I have commented my code, particularly in hard-to-understand areas