Skip to content

Commit b363d96

Browse files
petebacondarwinatscott
authored andcommitted
refactor(core): remove isObservable TODO (#39669)
This commit removes the TODO comment that proposed that we use the built-in RxJS `isObservable()` function. This is not a viable approach since the built-in function requires that the `obj` contains additional methods that our "observable" types (such as `EventEmitter`) do not necessarily have. See #39643 for more information. PR Close #39669
1 parent b8f9aa3 commit b363d96

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/src/util/lang.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ export function isPromise<T = any>(obj: any): obj is Promise<T> {
1919

2020
/**
2121
* Determine if the argument is an Observable
22+
*
23+
* Strictly this tests that the `obj` is `Subscribable`, since `Observable`
24+
* types need additional methods, such as `lift()`. But it is adequate for our
25+
* needs since within the Angular framework code we only ever need to use the
26+
* `subscribe()` method, and RxJS has mechanisms to wrap `Subscribable` objects
27+
* into `Observable` as needed.
2228
*/
2329
export function isObservable(obj: any|Observable<any>): obj is Observable<any> {
24-
// TODO: use isObservable once we update pass rxjs 6.1
25-
// https://github.com/ReactiveX/rxjs/blob/master/CHANGELOG.md#610-2018-05-03
2630
return !!obj && typeof obj.subscribe === 'function';
2731
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy