ReactiveX/rxjs

FromEvent Docs: No overload matches this call.

sumitrawat10 opened this issue · 4 comments

Describe the bug

As per the https://rxjs.dev/api/index/function/fromEvent in order to use this operator with capture option we can pass the three arguments to it.
image
But LSP is showing the following error.
image

Expected behavior

As per the documentation.
DOM EventTarget

This is an object with addEventListener and removeEventListener methods.

In the browser, addEventListener accepts - apart from event type string and event handler function arguments - optional third parameter, which is either an object or boolean, both used for additional configuration how and when passed function will be called. When fromEvent is used with event target of that type, you can provide this values as third parameter as well.

Reproduction code

Open the following example in Docs using StackBlitz "Use addEventListener with capture option" (https://rxjs.dev/api/index/function/fromEvent)

Reproduction URL

No response

Version

~7.5.0

Environment

No response

Additional context

No response

The problem is not in EventTarget but in the last argument.

Example

@demensky in the documentation it says that third argument is either or boolean or an object. If it's changed now ... Should I make ammendment in the docs and send a PR ?

@sumitrawat10
I can't find it in the official documentation. Maybe you are confused with the native method addEventListener in which it is once possible to pass boolean?

Screenshot_20230409-232958.jpg

In line 3.

Though at the top it says 'Use addEventListener with capture option'.