Skip to content

Conversation

@hearnden
Copy link
Contributor

This PR adds Single.never(), analogous to Flowable.never():

static never<U = empty>(): Flowable<U> {
return new Flowable(subscriber => {
subscriber.onSubscribe({
cancel: emptyFunction,
request: emptyFunction,
});
});
}

@hearnden
Copy link
Contributor Author

I also have a branch ready to turn into a PR for the corresponding change to DefinitelyTyped:

--- a/types/rsocket-flowable/Single.d.ts
+++ b/types/rsocket-flowable/Single.d.ts
@@ -47,6 +47,7 @@ export interface IFutureSubject<T> {
 export default class Single<T> {
     static of<U>(value: U): Single<U>;
     static error(error: Error): Single<never>;
+    static never(): Single<never>;
     constructor(source: Source<T>);
     subscribe(partialSubscriber?: Partial<IFutureSubscriber<T>>): void;
     flatMap<R>(fn: (data: T) => Single<R>): Single<R>;

@OlegDokuka
Copy link
Member

@hearnden just FYI. sending nullable subscription violates reactive streams spec -> https://github.com/reactive-streams/reactive-streams-js

@OlegDokuka OlegDokuka merged commit 91323ce into rsocket:master Mar 31, 2020
@OlegDokuka
Copy link
Member

@hearnden go ahead with the PR to DT

@hearnden
Copy link
Contributor Author

hearnden commented Apr 3, 2020

@hearnden go ahead with the PR to DT

Done: DefinitelyTyped/DefinitelyTyped#43603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants