mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Fix Rx.Observable.scan seeded overload
This commit is contained in:
parent
3fc1377ce2
commit
f06966b9ff
13
rx/rx-lite-tests.ts
Normal file
13
rx/rx-lite-tests.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/// <reference path="rx-lite.d.ts" />
|
||||
function test_scan() {
|
||||
|
||||
/* Without a seed */
|
||||
const source1: Rx.Observable<number> = Rx.Observable.range(1, 3)
|
||||
.scan((acc, x, i, source) => acc + x);
|
||||
|
||||
/* With a seed */
|
||||
const source2: Rx.Observable<string> = Rx.Observable.range(1, 3)
|
||||
.scan((acc, x, i, source) => acc + x, '...');
|
||||
|
||||
}
|
||||
|
||||
16
rx/rx-lite.d.ts
vendored
16
rx/rx-lite.d.ts
vendored
@ -323,8 +323,20 @@ declare module Rx {
|
||||
materialize(): Observable<Notification<T>>;
|
||||
repeat(repeatCount?: number): Observable<T>;
|
||||
retry(retryCount?: number): Observable<T>;
|
||||
scan<TAcc>(accumulator: (acc: TAcc, value: T, seed: TAcc) => TAcc): Observable<TAcc>;
|
||||
scan(accumulator: (acc: T, value: T) => T): Observable<T>;
|
||||
|
||||
/**
|
||||
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
|
||||
* For aggregation behavior with no intermediate results, see Observable.aggregate.
|
||||
* @example
|
||||
* var res = source.scan(function (acc, x) { return acc + x; });
|
||||
* var res = source.scan(function (acc, x) { return acc + x; }, 0);
|
||||
* @param accumulator An accumulator function to be invoked on each element.
|
||||
* @param seed The initial accumulator value.
|
||||
* @returns An observable sequence containing the accumulated values.
|
||||
*/
|
||||
scan<TAcc>(accumulator: (acc: TAcc, value: T, index?: number, source?: Observable<TAcc>) => TAcc, seed: TAcc): Observable<TAcc>;
|
||||
scan(accumulator: (acc: T, value: T, index?: number, source?: Observable<T>) => T): Observable<T>;
|
||||
|
||||
skipLast(count: number): Observable<T>;
|
||||
startWith(...values: T[]): Observable<T>;
|
||||
startWith(scheduler: IScheduler, ...values: T[]): Observable<T>;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user