Skip to content

combineLatest()

Function

combineLatest<I>(reads: readonly [I]): Read<ReturnTypesOf<I>, ContainsCancellingRead<I>>

Combines the latest results of all passed Reads.

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

Observable Behavior:

Works exactly like combineLatest of RxJS.

Sync Behavior:

Retrieves sync value of passed Reads. If one of those Reads cancels the read the result will be canceled.

Source: rxjs-read/src/lib/operators/combine-latest.ts:39

Type parameters

Parameter
I extends Read<unknown, boolean>[]

Parameters

ParameterTypeDescription
readsreadonly [I]Reads to combine

Returns

Read<ReturnTypesOf<I>, ContainsCancellingRead<I>>

Returns a new combined Read