But this will produce a TypeScript error at this.emit:
Property 'emit' does not exist on type 'PaymentService'.
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, the FeathersService type includes the emit() 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?
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?