Skip to content
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

Standardize <void>ReplaySubject to behave like <void>Subject #3312

Closed
euangoddard opened this issue Feb 12, 2018 · 3 comments
Closed

Standardize <void>ReplaySubject to behave like <void>Subject #3312

euangoddard opened this issue Feb 12, 2018 · 3 comments
Labels
TS Issues and PRs related purely to TypeScript issues

Comments

@euangoddard
Copy link

RxJS version: 5.5.6

Code to reproduce:

const replaySubject = new ReplaySubject<void>(1);
// At some later point
replaySubject.next();

Expected behavior: I can call next() without any arguments since the subject is a void type.

Actual behavior: I have to call next() with undefined or null to signal that something has happened to the replay subject.

Additional information: Essentially I want to use a replay subject to indicate whether something has happened. I need to use a ReplaySubject so that new subscribers connecting can know whether the subject has emitted in the past, but the value that subject emits is irrelevant to any subscribers (hence using a void replay subject).

This behaviour seems at odds with how Subject works and their implementation of next() differs. I noticed that this behaviour was changed here: #1728, but am unsure whether my proposed change will be accepted given this issue: #2852

I will be happy to submit a PR for this if this change would be accepted.

@kwonoj
Copy link
Member

kwonoj commented Feb 21, 2018

As discussed in #3074, we will wait for upstream change microsoft/TypeScript#12400 (comment) to properly support behavior around those. We probably won't going to introduce interim changes until then as it may break between changes we introduce.

@kwonoj kwonoj added TS Issues and PRs related purely to TypeScript issues status: upstream blocked labels Feb 21, 2018
@BioPhoton
Copy link
Contributor

@kwonoj or @cartant

This is already resolved. I tested it.

So imho this issue can be closed.

@cartant
Copy link
Collaborator

cartant commented Mar 14, 2021

Closing this because the problem has been resolved in v7 - in #5307, IIRC.

@cartant cartant closed this as completed Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TS Issues and PRs related purely to TypeScript issues
Projects
None yet
Development

No branches or pull requests

4 participants