I have this:

The code is like so:
process.emit('domainHavenRejection', 'unhandled rejection could not be pinned to a request/response.', e);
Obviously I am using TypeScript...is there a way to define a custom event on process, with the right type, or should I use a different event emitter?
Note that 'domainHavenRejection' is my desired custom event name, but it could be any custom event, obviously.
You can make compiler do not check types for emit() method.
(process.emit as Function)('domainHavenRejection');
Seems for now it is not possible to extend NodeJs interface. But take a look at this issue https://github.com/typings/registry/issues/770
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With