ReactiveX / ReactiveX/rxjs

fromEvent(Document) not typing correctly (still, ugh), boolean event useCapture option broken in TS

Open
#6,512 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

7.x bug
Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

I found this while updating another project from 5.5.* to 7.2.0. Basically, this doesn't work properly:

import { fromEvent } from 'rxjs';

declare const document: Document; // or just use document, duh

const result = fromEvent(document, 'click', true);
// Fails on two levels: 1 for `document` being invalid type, the other for `true` instead of `{ useCapture: true }`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the fromEvent entry point and reproduce the TypeScript example with Document and the boolean useCapture argument. Trace the relevant typings and verify that both the document target and the true option type-check correctly when the example is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.