-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typings): fix typings for error prone operators like concatAll
fixes concatAll, combineAll, exhaust, mergeAll, switch, zipAll. Also made a few improvements to how hot and cold observables are typed. A few compiler errors were fixed due to this change. fixes #2658 #2493 #2551
- Loading branch information
1 parent
766b5a7
commit 0804bcf
Showing
27 changed files
with
1,175 additions
and
946 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,49 @@ | ||
import {Observable} from '../../dist/cjs/Observable'; | ||
import {SubscriptionLog} from '../../dist/cjs/testing/SubscriptionLog'; | ||
import {ColdObservable} from '../../dist/cjs/testing/ColdObservable'; | ||
import {HotObservable} from '../../dist/cjs/testing/HotObservable'; | ||
import {TestScheduler, observableToBeFn, subscriptionLogsToBeFn} from '../../dist/cjs/testing/TestScheduler'; | ||
|
||
declare const global: any; | ||
|
||
export const rxTestScheduler: TestScheduler = global.rxTestScheduler; | ||
|
||
export function hot(marbles: string, values?: any, error?: any): HotObservable<any> { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use hot() in async test'; | ||
} | ||
return global.rxTestScheduler.createHotObservable.apply(global.rxTestScheduler, arguments); | ||
} | ||
|
||
export function cold(marbles: string, values?: any, error?: any): ColdObservable<any> { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use cold() in async test'; | ||
} | ||
return global.rxTestScheduler.createColdObservable.apply(global.rxTestScheduler, arguments); | ||
} | ||
|
||
export function expectObservable(observable: Observable<any>, | ||
unsubscriptionMarbles: string = null): ({ toBe: observableToBeFn }) { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use expectObservable() in async test'; | ||
} | ||
return global.rxTestScheduler.expectObservable.apply(global.rxTestScheduler, arguments); | ||
} | ||
|
||
export function expectSubscriptions(actualSubscriptionLogs: SubscriptionLog[]): ({ toBe: subscriptionLogsToBeFn }) { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use expectSubscriptions() in async test'; | ||
} | ||
return global.rxTestScheduler.expectSubscriptions.apply(global.rxTestScheduler, arguments); | ||
} | ||
|
||
export function time(marbles: string): number { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use time() in async test'; | ||
} | ||
return global.rxTestScheduler.createTime.apply(global.rxTestScheduler, arguments); | ||
import {Observable} from '../../dist/cjs/Observable'; | ||
import {SubscriptionLog} from '../../dist/cjs/testing/SubscriptionLog'; | ||
import {ColdObservable} from '../../dist/cjs/testing/ColdObservable'; | ||
import {HotObservable} from '../../dist/cjs/testing/HotObservable'; | ||
import {TestScheduler, observableToBeFn, subscriptionLogsToBeFn} from '../../dist/cjs/testing/TestScheduler'; | ||
|
||
declare const global: any; | ||
|
||
export const rxTestScheduler: TestScheduler = global.rxTestScheduler; | ||
|
||
export function hot(marbles: string, values?: void, error?: any): HotObservable<string>; | ||
export function hot<V>(marbles: string, values?: { [index: string]: V; }, error?: any): HotObservable<V>; | ||
export function hot<V>(marbles: string, values?: { [index: string]: V; } | void, error?: any): HotObservable<any> { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use hot() in async test'; | ||
} | ||
return global.rxTestScheduler.createHotObservable.apply(global.rxTestScheduler, arguments); | ||
} | ||
|
||
export function cold(marbles: string, values?: void, error?: any): ColdObservable<string>; | ||
export function cold<V>(marbles: string, values?: { [index: string]: V; }, error?: any): ColdObservable<V>; | ||
export function cold<V>(marbles: string, values?: { [index: string]: V; } | void, error?: any): ColdObservable<V> { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use cold() in async test'; | ||
} | ||
return global.rxTestScheduler.createColdObservable.apply(global.rxTestScheduler, arguments); | ||
} | ||
|
||
export function expectObservable(observable: Observable<any>, | ||
unsubscriptionMarbles: string = null): ({ toBe: observableToBeFn }) { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use expectObservable() in async test'; | ||
} | ||
return global.rxTestScheduler.expectObservable.apply(global.rxTestScheduler, arguments); | ||
} | ||
|
||
export function expectSubscriptions(actualSubscriptionLogs: SubscriptionLog[]): ({ toBe: subscriptionLogsToBeFn }) { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use expectSubscriptions() in async test'; | ||
} | ||
return global.rxTestScheduler.expectSubscriptions.apply(global.rxTestScheduler, arguments); | ||
} | ||
|
||
export function time(marbles: string): number { | ||
if (!global.rxTestScheduler) { | ||
throw 'tried to use time() in async test'; | ||
} | ||
return global.rxTestScheduler.createTime.apply(global.rxTestScheduler, arguments); | ||
} |
Oops, something went wrong.