Skip to content

When an Observable emits a function #152

Closed
@ilikejames

Description

@ilikejames

Upgrading from @react-rxjs/[email protected] -> @react-rxjs/[email protected] came across this regression.

When an observable returns a function, we get a stringified (plus evaluated!) version of the function. This worked in the prior version.

const counter$ = timer(0, 1000).pipe(startWith(0), shareReplay(1));

const [useBoundMethodThatDoesntWork] = bind(() =>
  counter$.pipe(
    map((count) => {
      return (s) => `${s}: ${count}`;
    })
  )
);

// .....


const method = useBoundMethod();
method('a') // -> Not a function
typeof method // -> 'stirng'
return ({method})
  // -> function (s) { return "".concat(s, ": ").concat(count); }: 0:

Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions