You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
say for some reason, I want to wrap the source event like process#message in my class
then provide a pipe api to MY USER like following
constrawSource$=fromEvent(process,"message")asObservable<[string, ...unknown[]]>;classFromParent{source$=rawSource$;// just overloads to make users happypipe(): Observable<string>;pipe<A>(op1: OperatorFunction<string,A>): Observable<A>;pipe<A,B>(op1: OperatorFunction<string,A>,op2: OperatorFunction<A,B>): Observable<B>;pipe<A,B,C>(op1: OperatorFunction<string,A>,op2: OperatorFunction<A,B>,op3: OperatorFunction<B,C>): Observable<C>;// we provide our own pipe method, to enforce common logics like dataMapping, logging and fallback ErrorCatchpipe(...ops: OperatorFunction<any,any>[]){returnthis.source$.pipe(map(([msg, ...rest])=>msg),tap((msg)=>console.log(msg)),mergeMap((msg)=>of(msg)// !!! ts(2556) is thrown here!: A spread argument must either have a tuple type or be passed to a rest parameter.// My question: How to avoid ts type check error here.pipe(...ops).pipe(catchError((e)=>{console.error(e);returnEMPTY;}))));}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
say for some reason, I want to wrap the source event like process#message in my class
then provide a pipe api to MY USER like following
I'm using
rxjs: ^7.3.0
andtypescript: 4.4.2
Beta Was this translation helpful? Give feedback.
All reactions