isObservable
Checks if a value is an RxJS Observable or any compatible observable.
Uses duck-typing: returns true for any object with both .subscribe() and
.pipe() methods, covering Observable, Subject, BehaviorSubject,
ReplaySubject, and any RxJS-compatible observable implementation.
Available since v2.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check |
Returns
Section titled “Returns”value is Observable<unknown> — true if value is observable-like
Examples
Section titled “Examples”Detect an RxJS Observable or Subject
Section titled “Detect an RxJS Observable or Subject”Returns true for Observable, Subject, BehaviorSubject, and any duck-typed observable.
Accept either an Observable or a plain value
Section titled “Accept either an Observable or a plain value”Use as a guard to normalize inputs that may be Observables or raw values.
