Replies: 1 comment
-
This is a good question, extending from EventEmitter seems like the cleanest solution to me. I found it quite difficult in TypeScript to deal with extended classes that have additional functionality. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the documentation on custom events it shows the following example code for TypeScript:
But this will produce a TypeScript error at
this.emit
:I can solve this with
PaymentService extends EventEmitter
, but it seems like it would be better if there was a Feathers typing solution. I've been unsuccessful solving the issue using Feathers' types. For example, theFeathersService
type includes theemit()
addon but since it is only an interface,PaymentService implements FeathersService<...>
doesn't actually endow the class with this property. Any recommendations on the best way to type this?Beta Was this translation helpful? Give feedback.
All reactions