fix(core): use presence of .subscribe to detect observables rather then Symbol.observable (#15171)
Fixes #14298 Fixes #14473 Fixes #14926
This commit is contained in:

committed by
Chuck Jazdzewski

parent
313158132d
commit
6e98757665
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {$$observable as symbolObservable} from 'rxjs/symbol/observable';
|
||||
|
||||
/**
|
||||
* Determine if the argument is shaped like a Promise
|
||||
@ -22,7 +21,8 @@ export function isPromise(obj: any): obj is Promise<any> {
|
||||
* Determine if the argument is an Observable
|
||||
*/
|
||||
export function isObservable(obj: any | Observable<any>): obj is Observable<any> {
|
||||
return !!(obj && obj[symbolObservable]);
|
||||
// TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
|
||||
return !!obj && typeof obj.subscribe === 'function';
|
||||
}
|
||||
|
||||
// TODO(misko): replace with Object.assign once we require ES6.
|
||||
|
Reference in New Issue
Block a user