-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typing of 3 param version of fromEvent
in v7 is not compatible with EventEmitter
of node.js
#6301
Comments
Caused by #6214 |
Needs a minimal reproduction. This seems to be fine, for me with the versions you mentioned: import { fromEvent } from "rxjs";
const beforeExit = fromEvent(process, "beforeExit"); |
Sorry, I imported an EventEmitter that is not from 'node' when trying to craft a minimal repo. fromEvent(process, 'SIGINT', {once: true}); does not compile. |
fromEvent
in v7 is not compatible with EventEmitter
of node.jsfromEvent
in v7 is not compatible with EventEmitter
of node.js
AFAICT, this doesn't compile using the Node types: process.addListener("SIGINT", { once: true }); And the Node documentation makes no mention of an options parameter, so I don't see why we should pass it. If you were relying on this in v6, I am not at all sure that it would have been doing what you thought it was. This is the v6 implementation and it does not pass options to a Node-style target. rxjs/src/internal/observable/fromEvent.ts Lines 221 to 223 in 881cacd
|
Umm, the original intent in my codebase was to subscribe to the event for once, so the |
And the 3-param overload of |
Bug Report
Current Behavior
Typing of
fromEvent
in v7 is not compatible withEventEmitter
of node.js, while its declaration claims it's accepted.Expected behavior
It shall be compatible with v6.
Reproduction
Environment
Actually, it's Typescript that does not resolve function overload properly when the function signature contains union type, but at least Typescript is still able to resolve overload by the number of arguments, which is why declaration in v6 works.
The text was updated successfully, but these errors were encountered: