-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return type of .ignoreElements() and .empty() should be Observable<never> #2640
Comments
const obs = condition ? Observable.empty() : Observable.of(1, 2, 3)
|
Hi @felixfbecker. |
Yep. As said, in a union with declare let a: Observable<never>;
declare let b: Observable<number>;
const c = a.concat(b); // Observable<number> |
…() now return Observable<never> fixes ReactiveX#2640 BREAKING CHANGE: Previously, `Observable.never()` `Observable.empty()` and the `.ignoreElements()` operator all returned `Observable<T>` which was incorrect since they actually never emit anything. Now they all return `Observable<never>` (`never` was added in TS 2.0 as a special type)
…() now return Observable<never> fixes ReactiveX#2640 BREAKING CHANGE: Previously, `Observable.never()` `Observable.empty()` and the `.ignoreElements()` operator all returned `Observable<T>` which was incorrect since they actually never emit anything. Now they all return `Observable<never>` (`never` was added in TS 2.0 as a special type)
…() now return Observable<never> fixes ReactiveX#2640 BREAKING CHANGE: Previously, `Observable.never()` `Observable.empty()` and the `.ignoreElements()` operator all returned `Observable<T>` which was incorrect since they actually never emit anything. Now they all return `Observable<never>` (`never` was added in TS 2.0 as a special type)
…() now return Observable<never> fixes ReactiveX#2640 BREAKING CHANGE: Previously, `Observable.never()` `Observable.empty()` and the `.ignoreElements()` operator all returned `Observable<T>` which was incorrect since they actually never emit anything. Now they all return `Observable<never>` (`never` was added in TS 2.0 as a special type)
…() now return Observable<never> fixes ReactiveX#2640 BREAKING CHANGE: Previously, `Observable.never()` `Observable.empty()` and the `.ignoreElements()` operator all returned `Observable<T>` which was incorrect since they actually never emit anything. Now they all return `Observable<never>` (`never` was added in TS 2.0 as a special type)
…() now return Observable<never> (#2691) fixes #2640 BREAKING CHANGE: Previously, `Observable.never()` `Observable.empty()` and the `.ignoreElements()` operator all returned `Observable<T>` which was incorrect since they actually never emit anything. Now they all return `Observable<never>` (`never` was added in TS 2.0 as a special type)
Per ReactiveX#2640 ignoreElements should resolve to Observable<never>, ReactiveX#3340 asks for this explicitly, there was also another issue with tests2png that I fix here Closes ReactiveX#3340
Previous change tried to add the correct return type but ended up adding Observable<Observable<never>> which is not what was requested ReactiveX#3340 and ReactiveX#2640
#3410) * refactor(ignoreElements): ignoreElements now returns Observable<never> Per #2640 ignoreElements should resolve to Observable<never>, #3340 asks for this explicitly, there was also another issue with tests2png that I fix here Closes #3340, #3410 * refactor(ignoreElements): Wrong return type on type of ignoreElements Previous change tried to add the correct return type but ended up adding Observable<Observable<never>> which is not what was requested #3340 and #2640
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
RxJS version: 5.4.0
Code to reproduce:
Expected behavior:
Inferred return type of
updateFiles
should beObservable<never>
. The Observable never emits items, so the items don't have a type, similar to how a function that always throws has no return type - itnever
emits/returns.Actual behavior:
Emitted return type is
Observable<string>
The text was updated successfully, but these errors were encountered: