Reputation: 148624
I'm using an external package which emits an Observable :
getValue(key: string | Array<string>, interpolateParams?: Object): Observable<string | any> {
return null;
}
I also use the first
lettable operator :
import { first } from "rxjs/operators/first";
this.getValue('f').let(first);
But I'm getting an error :
Type 'Observable' provides no match for the signature '(value: any, index: number, source: Observable): value is any'.
I can see where the problem comes from.
The first
operator is :
export function first(predicate?: (value: T, index: number, source: Observable) => boolean): MonoTypeOperatorFunction;
And my Observable is type <any>
Question:
How can I fix my lettable
operator to work with the Observable ^ ?
Online-demo which shows the problem
Upvotes: 0
Views: 213
Reputation: 68665
Try to call first in the let
. It will return a function which will be applied by the stream. Also use pipe
instead if let
this.getValue('f').pipe(first())
Upvotes: 1