Questions tagged [rxjs6]

RxJS6 is version 6 of Reactive Extensions for JavaScript, with some added changes in websocket, testing and bug fixes.

1219 questions
12
votes
1 answer

BehaviorSubject map a BehaviorSubject

I have a rxjs@6 BehaviorSubject source$, I want get subvalue from source$ const source$ = new BehaviorSubject(someValue); const subSource$ = source$.pipe(map(transform)); I expect the subSource$ also is a BehaviorSubject, but is not and How can…
quanwei li
  • 354
  • 2
  • 16
12
votes
1 answer

How do I mock RxJs 6 timer?

We've recently updated from Angular 5 to Angular 6, and with it RxJs 6. As part of the migration, the timer usage has changed from: Observable.timer() to timer() There are a number of places in our tests where we mock timer observables with the…
MGDavies
  • 1,024
  • 1
  • 17
  • 30
12
votes
2 answers

RXJS 6: new version of HttpInterceptor

I am in the process of adding rxjs_compat to my project in order to move to v6 of libraries. However the existing HttpInterceptor for global error handling no longer compiles. Not sure where to go with it. Tried all sorts. Getting type mismatches…
jenson-button-event
  • 18,101
  • 11
  • 89
  • 155
12
votes
1 answer

TypeScript module Augmentation

I have extension for observable. It was working perfectly fine but now I've updated to angular 6 with typescript 2.7.2. import { Observable } from 'rxjs/Observable'; import { BaseComponent } from './base-component'; import { Subscription } from…
Vova Bilyachat
  • 18,765
  • 4
  • 55
  • 80
11
votes
3 answers

How to properly chain rxjs 6 observables?

Any suggestions, how this can be rewritten in more promise-chaining style?: this.apiService.sendPutRequest('/api/users/activate', usrObj).pipe( map(() => { return this.apiService.sendGetRequest('/api/users/' +…
askona
  • 390
  • 1
  • 5
  • 16
11
votes
1 answer

How to type array map arguments from rxjs 6 withLatestFrom

Before Rxjs 6 we could do: interface TypeA { payload: any; } source$.pipe( withLatestFrom(source2$, (source1: TypeA, source2: TypeB) => ({ payload: source1.payload, source2 }) ), ) We could, in the resultSelector method arguments, add…
BlackHoleGalaxy
  • 9,160
  • 17
  • 59
  • 103
11
votes
1 answer

RXJS6 Upgrade: ErrorObservable has no exported member 'ErrorObservable'

I have upgraded my Angular 5 app to 6.0.1 and RxJs to 6.1.0. In one of my services, I have the import below: import { ErrorObservable } from 'rxjs/observable/ErrorObservable'; However, I now get the following error: Module…
Polajenko
  • 399
  • 3
  • 9
10
votes
3 answers

RxJs6: OperatorFunction vs MonoTypeOperatorFunction

I have the following code: export class EventsChainComponent { eventSubscriber:Subscription; constructor (protected eventService: EventService) {} public registerComponentsEvent(event:any) { // getOnEvent signature //…
Ricardo Rocha
  • 14,612
  • 20
  • 74
  • 130
10
votes
1 answer

Property 'filter' does not exist on type 'BehaviorSubject'. in rxjs 6

On upgrade of rx js from 5 to 6, throws below error [ts] Property 'filter' does not exist on type 'BehaviorSubject'. Current Behavior import {BehaviorSubject} from 'rxjs'; tokenSubject: BehaviorSubject = new…
user630209
  • 1,123
  • 4
  • 42
  • 93
10
votes
2 answers

Rxjs 6 equivalent of Observable.create(subscriber -> {...}).share()

I'm upgrading my Angular 5 app to Angular 6 and consequently from rxjs 5 to rxjs 6, I'm experiencing troubles in migrating the following piece of code: const myObservable = Observable.create(subscriber => { // do something with the…
Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
10
votes
1 answer

How to bind the selected value of angular dropdown to an Observable of scalar value?

I have an angular material select component and I would like to bind the selected value of the dropdown to an Observable of scalar from firebase. I would like to do this without unwrapping the observable in component. It looks I cannot bind the…
user2202866
  • 91
  • 6
  • 14
9
votes
1 answer

How to get previous value of RxJS Subject?

I my project I need to compare my paginator's pageSize value (items per page) with the previous value and if the new one is higher, then I need to load datas from storage. But if it's not higher I don't want to do anything. For example in this…
netdjw
  • 5,419
  • 21
  • 88
  • 162
9
votes
1 answer

How to stop subscription by using multiple conditions with takeUntil

I wanna stop a observable subscription based on two conditions: Time (using import { timer } from 'rxjs/internal/observable/timer';) OR Execution status (using the returned object from request that you'll see below) What is happenning: It's only…
Joao Albuquerque
  • 366
  • 1
  • 3
  • 15
9
votes
1 answer

How to understand complicated typescript generic types?

I was checking RxJS api documents. I always face problem in understanding the weird syntax written on the top, Which is like below as an example: combineLatest, R>(...observables: (O | ((...values:…
Rakesh Joshi
  • 371
  • 1
  • 10
9
votes
5 answers

RxJS mergeMap() with original order

The abstract problem Is there any way to consume the result of a mergeMap in the original order of the outer observable, while still allowing the inner observables to run in parallel? More detailed explanation Let's look at two merge-mapping…
Joseph Silber
  • 214,931
  • 59
  • 362
  • 292