-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
TLDR: I have implemented a fromEvent
alternative that is type-safe and has some additional features. And I want to know if I can open a PR. :)
So, as you people might know fromEvent
's types are not really great which is fair considering when they were written it wasn't possible to statically type it. But now we can have better types for fromEvent
.
So in this light, I implemented rxjs-from-emitter. I recommend checking out the readme to see all it's features, but in short these are it's two major features -
- Correct
Observable
inferences corresponding to listener's arguments. - Static checking if an event exists or not.
If this implementation is in alignment with RxJS's goals and interests, I would be more than happy to send a PR :) I have answers to all your questions. Also don't get distracted with the change in API, it's the types that are important. To put it in the perspective runtime code is ~100 LOC where as type-level code is ~600 LOC.
Also additional to the type-safety, according to me there are some (respectfully) design-level flaws of fromEvent
that rxjs-from-emitter solves which I have documented here.
PS: In case this comes across a publicity stunt to promote my package or whatever, it's not. I love RxJS and I genuinely want to make it better :)
Also I will take this opportunity to thank everyone that constantly works on RxJS to make it better!