Skip to content

withLatestFrom()

Function

withLatestFrom<I, R>(read: R): MaybeCancellingPipeOperator<I, [I, ReadReturn<R>], IsCancellingRead<R>>

Combines the latest result of the passed Read.

ts
// without a cancelling Read
declare const read1: Read<string>;
declare const read2: Read<number>;
const read: Read<[string, number]> = read1.pipe(withLatestFrom<string, typeof read2>(read2));
ts
// with a cancelling Read
declare const read1: Read<string>;
declare const read2: Read<number, true>;
const read: Read<[string, number], true> = read1.pipe(withLatestFrom<string, typeof read2>(read2));

Observable Behavior:

Works exactly like withLatestFrom of RxJS.

Sync Behavior:

Retrieves sync value of passed Read. If the passed read canceled the chain, then the chain will be canceled.

Source: lib/operators/with-latest-from.operator.ts:40

Type parameters

Parameter
I
R extends Read<any, any>

Parameters

ParameterTypeDescription
readRRead to combine

Returns

MaybeCancellingPipeOperator<I, [I, ReadReturn<R>], IsCancellingRead<R>>