Skip to content

Commit

Permalink
fix(testscheduler): type arguments to Observable creation functions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfbecker authored and benlesh committed Jul 25, 2018
1 parent 0f4c532 commit 0e30ef1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions spec/schedulers/TestScheduler-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>('--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());
Expand All @@ -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<string>('--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());
Expand Down
14 changes: 12 additions & 2 deletions src/internal/testing/TestScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export class TestScheduler extends VirtualTimeScheduler {
return indexOf * TestScheduler.frameTimeFactor;
}

createColdObservable<T>(marbles: string, values?: any, error?: any): ColdObservable<T> {
/**
* @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<T = string>(marbles: string, values?: { [marble: string]: T }, error?: any): ColdObservable<T> {
if (marbles.indexOf('^') !== -1) {
throw new Error('cold observable cannot have subscription offset "^"');
}
Expand All @@ -58,7 +63,12 @@ export class TestScheduler extends VirtualTimeScheduler {
return cold;
}

createHotObservable<T>(marbles: string, values?: any, error?: any): HotObservable<T> {
/**
* @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<T = string>(marbles: string, values?: { [marble: string]: T }, error?: any): HotObservable<T> {
if (marbles.indexOf('!') !== -1) {
throw new Error('hot observable cannot have unsubscription marker "!"');
}
Expand Down

0 comments on commit 0e30ef1

Please sign in to comment.