Type-Safe
All types are inferred from your event emitter and can always be extended! Automatically!
Add decorator-powered, class-based and fully typed event handlers to your [nodejs, emittery, web... everything] app!

handlery (like emittery but for 'handle') is a super clean and easy way to handle any kind of events with class-based handlers (and decorators!). It works with all kinds of event emitters (emittery, nodejs' EventEmitter...) out of the box! Just look at it:
@register()
class UserHandler extends EventHandler {
@on('user.add')
public handleAddUser(user: Events['user.add'], ctx: HandlerContext) {
ctx.emitter.emit('user.add.response', { ... })
// ...
}
}It requires typescript decorators support (modern, ECMA decorators. Not Decorators.Legacy etc.) And an event emitter like emittery or node's built-in EventEmitter.
It's on npm!
npm install handlery
# or
pnpm add handlery
# or
yarn add handlery