Open psi-4ward opened 1 year ago
It would be very nice to have types on the eventemitter of services. This issue should track the request.
Currently I go with an own helper method on the service which types on():
on()
export type MyService = Static<typeof processSchema> export type MyServiceEvents = { created: MyService; removed: MyService; // ... } export class MyServiceService<ServiceParams extends MyServiceParams = MyServiceParams> implements ServiceInterface<MyService, MyServiceData, ServiceParams> { //... // Helper method for typed events onTyped<EventName extends keyof MyServiceEvents>(eventName: EventName, handler: (payload: MyServiceEvents[EventName]) => void) { this.getService().on(eventName, handler); } }
But we should think about to get this into feathers-core.
It would be very nice to have types on the eventemitter of services. This issue should track the request.
Currently I go with an own helper method on the service which types
on()
:But we should think about to get this into feathers-core.