Angular 6 ng lint combineLatest is deprecated
combineLatest is deprecated: resultSelector no longer supported, pipe to map instead
The above warning is recommending to remove the resultSelector the last function you provided in combineLatest observable and provide it as part of map operator as follows
const a$ = combineLatest( this.aStore.select(b.getAuth), this.cStore.select(b.getUrl));const result$ = a$.pipe( map(results => ({auth: results[0], url: results[1]})))
UPDATE:
If you see combineLatest is deprecated: Pass arguments in a single array instead
then just add []:
const a$ = combineLatest([ this.aStore.select(b.getAuth), this.cStore.select(b.getUrl)]); const result$ = a$.pipe( map(results => ({auth: results[0], url: results[1]})))
Unlike the deprecated versions, combineLatest
accepts an Array of Observable
and returns an array containing the latest values from each. Every stream has to yield in order for combineLatest
to yield.
fruitType$ = combineLatest([this.entity$, this.datasetStateService.get$('Fruits')]) .pipe(map(data => { const entity = data[0]; const dataset = data[1]; return { isApple: (dataset.find(ds => ds.label === 'Apple') as DataItem).id === entity.fruitId, isOrange: (dataset.find(ds => ds.label === 'Orange') as DataItem).id === entity.fruitId }}));