From 0e30ef1ba8a1985184b552edbc285220d7417088 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Wed, 25 Jul 2018 12:14:20 -0700 Subject: [PATCH] fix(testscheduler): type arguments to Observable creation functions (#3928) --- spec/schedulers/TestScheduler-spec.ts | 4 ++-- src/internal/testing/TestScheduler.ts | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/spec/schedulers/TestScheduler-spec.ts b/spec/schedulers/TestScheduler-spec.ts index dfb54fa0fc..9d15b7b6e8 100644 --- a/spec/schedulers/TestScheduler-spec.ts +++ b/spec/schedulers/TestScheduler-spec.ts @@ -145,7 +145,7 @@ describe('TestScheduler', () => { it('should create a cold observable', () => { const expected = ['A', 'B']; const scheduler = new TestScheduler(null); - const source = scheduler.createColdObservable('--a---b--|', { a: 'A', b: 'B' }); + const source = scheduler.createColdObservable('--a---b--|', { a: 'A', b: 'B' }); expect(source).to.be.an.instanceOf(Observable); source.subscribe(x => { expect(x).to.equal(expected.shift()); @@ -159,7 +159,7 @@ describe('TestScheduler', () => { it('should create a cold observable', () => { const expected = ['A', 'B']; const scheduler = new TestScheduler(null); - const source = scheduler.createHotObservable('--a---b--|', { a: 'A', b: 'B' }); + const source = scheduler.createHotObservable('--a---b--|', { a: 'A', b: 'B' }); expect(source).to.be.an.instanceof(Subject); source.subscribe(x => { expect(x).to.equal(expected.shift()); diff --git a/src/internal/testing/TestScheduler.ts b/src/internal/testing/TestScheduler.ts index 1de9d40ba0..4874389511 100644 --- a/src/internal/testing/TestScheduler.ts +++ b/src/internal/testing/TestScheduler.ts @@ -45,7 +45,12 @@ export class TestScheduler extends VirtualTimeScheduler { return indexOf * TestScheduler.frameTimeFactor; } - createColdObservable(marbles: string, values?: any, error?: any): ColdObservable { + /** + * @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided. + * @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used. + * @param error The error to use for the `#` marble (if present). + */ + createColdObservable(marbles: string, values?: { [marble: string]: T }, error?: any): ColdObservable { if (marbles.indexOf('^') !== -1) { throw new Error('cold observable cannot have subscription offset "^"'); } @@ -58,7 +63,12 @@ export class TestScheduler extends VirtualTimeScheduler { return cold; } - createHotObservable(marbles: string, values?: any, error?: any): HotObservable { + /** + * @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided. + * @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used. + * @param error The error to use for the `#` marble (if present). + */ + createHotObservable(marbles: string, values?: { [marble: string]: T }, error?: any): HotObservable { if (marbles.indexOf('!') !== -1) { throw new Error('hot observable cannot have unsubscription marker "!"'); }