typed-emitter
typed-emitter copied to clipboard
🔩 Type-safe event emitter interface for TypeScript
Does typed-emitter have support for the "once" function of the "events" inbuilt package? https://github.com/nodejs/node/pull/26078 Used like this: ```typescript import { once } from "events" // ... await once(emitter, "event"); ```...
Problem: ```ts class Foo extends (EventEmitter as new () => TypedEmitter void}>) { constructor() { super(); this.emit("1"); // error should be no error } } ``` After fix: ```ts class...
The example for generics in the documentation does not work: ``` class MyEventEmitter extends (EventEmitter as { new(): TypedEmitter }) { // ... } ``` Just gives `error TS2344: Type...
Thank you for the package! I'm struggling to achieve something that I'm sure is an easy task for some. Is this possible? How can I extend an abstract `EventEmitter` class,...
Hey! I just installed typed-emitter v2.0.0 and am not sure how to use it now. The code that worked previously and that still follows what is in the readme, ```ts...
Hi, @andywer I hope you are doing well! Recently I'm enjoying your typed-emitter module, it really nice, I love it! After I armed all my EventEmitter with the beautiful `typed-emitter`,...
Hey there! Is there any way to type events with variable event names? Specifically, i am trying to type https://github.com/PrismarineJS/prismarine-world/blob/55a6f78b4802519b7bee7ace20daa7e956e6ca7f/src/worldsync.js#L69 The World Class emits events called `blockUpdate:${position}`, which stringifies to...
This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript'
When using pkg to pack a node application I get the following error, how do I solve this? ``` [debug] Content of %1 is added to queue %1: C:\Users\henri\git\xot_client\nodejs\xot_proxy\node_modules\typed-emitter\index.d.ts >...
I'm running into a problem with trying to correctly type a utility function when using the "base class" version of `TypedEmitter`. My application has an `on` helper that wraps `EventEmitter#on`...
If using RxJS >=7.5.6, we could not parse rxjs's `fromEvent` to a `typed-emitter/rxjs` `fromEvent` : ``` import { fromEvent as rxFromEvent } from 'rxjs' const fromEvent = rxFromEvent as FromEvent...