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

style(cqrs): fix typing for CommandHandler to actually accept the type of class extending ICommand #1206

Merged
merged 1 commit into from
Feb 9, 2023

Conversation

NOtherDev
Copy link
Contributor

@NOtherDev NOtherDev commented Nov 25, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe: Typing fix

What is the current behavior?

I extended ICommand interface via TypeScript's Declaration Merging, adding own properties there, so that I can enforce all my commands to adhere to some standard format. This made my code not compile due to invalid/incomplete typing for CommandHandler decorator, which expects ICommand instance passed as an argument, while the documented intention is that it accepts ICommand-compatible type.

Issue Number: N/A

What is the new behavior?

I extended the existing typing so that the actual class type that implements ICommand is accepted by CommandHandler decorator.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@NOtherDev NOtherDev changed the title Fix typing for CommandHandler to actually accept the type of class extending ICommand style(cqrs): fix typing for CommandHandler to actually accept the type of class extending ICommand Nov 25, 2022
@kamilmysliwiec
Copy link
Member

lgtm

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