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

feat(lastValue): Adds lastValue method to Observable #5076

Closed
wants to merge 1 commit into from

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Oct 15, 2019

PROPOSED CHANGE

This is meant to be a more well-behaved, a better-named, replacement for toPromise.

Resolves #5075

This is meant to be a more well-behaved, a better-named, replacement for `toPromise`.

Resolves ReactiveX#5075
@ncjamieson
Copy link

@benlesh Could this be refactored into the static method that was discussed in the core team meeting?

import { lastValue, of } from "rxjs";

function example () {
  const value = await lastValue(of(42));
}

IIRC, I might have previously had reservations about the name. If that was the case, I've changed my mind. I think lastValue is nice and is a big improvement on toPromise. (The name describes the behaviour and the types will tell people that it returns a promise.)

@cartant
Copy link
Collaborator

cartant commented Feb 7, 2020

Closing this in favour of #5295

@cartant cartant closed this Feb 7, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

toPromise should reject if no value is emitted.
3 participants