question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

definition file for "do" operator doesn't match the do(null, fn)

See original GitHub issue

RxJS version: 5.5.6 Code to reproduce:

    new Observable((observer) => {
      observer.next("Yeah !");
      observer.error("error !");
    }).do(null, err => {
      console.log('oops!!!!');
    }).subscribe(something => console.log(something));

Expected behavior: Able to use the do(null, fn);

Actual behavior: I can’t compile my application. I have to use a dummy function to make it work.

    new Observable((observer) => {
      observer.next("Yeah !");
      observer.error("error !");
    }).do(() => {}, err => {
      console.log('oops!!!!');
    }).subscribe(something => console.log(something));

Additional information: RxJS 4 had the doOnError, but RxJS 5 merged that operator with the normal " do", with passing a « null » value has the first arguments, but it doesn’t works.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
benleshcommented, Apr 12, 2018

I’m unable to reproduce your error in JavaScript: http://jsbin.com/kewohibice/edit?js,console

I suspect the issue you’re hitting is in TypeScript, in that case you can pass undefined and you’ll be fine.

Better

I highly suggest you use: do({ error(err) { console.log('oops' } }) which is more readable and explicit.

0reactions
lock[bot]commented, Jun 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Do's and Don'ts - TypeScript
Recommendations for writing d.ts files. ... Do use the types number , string , boolean , and symbol . ... declare function fn(x:...
Read more >
"satisfies" operator to ensure an expression matches some ...
I find I have to do this once in a while. I don't think the approach to satisfies is responsible for a situation...
Read more >
Is there a way to check for both `null` and `undefined`?
Using a juggling-check, you can test both null and undefined in one hit: if (x == null) {. If you use a strict-check,...
Read more >
XPath and XQuery Functions and Operators 3.1 - W3C
This document defines constructor functions, operators, and functions on the datatypes defined in [XML Schema Part 2: Datatypes Second ...
Read more >
Condition functions - AWS CloudFormation
Returns true for a condition that evaluates to false or returns false for a condition that evaluates to true . Fn::Not acts as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found