Skip to content

Commit 0e30ef1

Browse files
felixfbeckerbenlesh
authored andcommitted
fix(testscheduler): type arguments to Observable creation functions (#3928)
1 parent 0f4c532 commit 0e30ef1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

spec/schedulers/TestScheduler-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe('TestScheduler', () => {
145145
it('should create a cold observable', () => {
146146
const expected = ['A', 'B'];
147147
const scheduler = new TestScheduler(null);
148-
const source = scheduler.createColdObservable<string>('--a---b--|', { a: 'A', b: 'B' });
148+
const source = scheduler.createColdObservable('--a---b--|', { a: 'A', b: 'B' });
149149
expect(source).to.be.an.instanceOf(Observable);
150150
source.subscribe(x => {
151151
expect(x).to.equal(expected.shift());
@@ -159,7 +159,7 @@ describe('TestScheduler', () => {
159159
it('should create a cold observable', () => {
160160
const expected = ['A', 'B'];
161161
const scheduler = new TestScheduler(null);
162-
const source = scheduler.createHotObservable<string>('--a---b--|', { a: 'A', b: 'B' });
162+
const source = scheduler.createHotObservable('--a---b--|', { a: 'A', b: 'B' });
163163
expect(source).to.be.an.instanceof(Subject);
164164
source.subscribe(x => {
165165
expect(x).to.equal(expected.shift());

src/internal/testing/TestScheduler.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ export class TestScheduler extends VirtualTimeScheduler {
4545
return indexOf * TestScheduler.frameTimeFactor;
4646
}
4747

48-
createColdObservable<T>(marbles: string, values?: any, error?: any): ColdObservable<T> {
48+
/**
49+
* @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
50+
* @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
51+
* @param error The error to use for the `#` marble (if present).
52+
*/
53+
createColdObservable<T = string>(marbles: string, values?: { [marble: string]: T }, error?: any): ColdObservable<T> {
4954
if (marbles.indexOf('^') !== -1) {
5055
throw new Error('cold observable cannot have subscription offset "^"');
5156
}
@@ -58,7 +63,12 @@ export class TestScheduler extends VirtualTimeScheduler {
5863
return cold;
5964
}
6065

61-
createHotObservable<T>(marbles: string, values?: any, error?: any): HotObservable<T> {
66+
/**
67+
* @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
68+
* @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
69+
* @param error The error to use for the `#` marble (if present).
70+
*/
71+
createHotObservable<T = string>(marbles: string, values?: { [marble: string]: T }, error?: any): HotObservable<T> {
6272
if (marbles.indexOf('!') !== -1) {
6373
throw new Error('hot observable cannot have unsubscription marker "!"');
6474
}

0 commit comments

Comments
 (0)