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

firstValueFrom not matching documented behavior #7538

Closed
jpage-godaddy opened this issue Mar 11, 2025 · 1 comment
Closed

firstValueFrom not matching documented behavior #7538

jpage-godaddy opened this issue Mar 11, 2025 · 1 comment

Comments

@jpage-godaddy
Copy link

Describe the bug

According to the documentation for firstValueFrom:

If the observable stream completes before any values were emitted, the returned promise will reject with EmptyError or will resolve with the default value if a default was specified.

However, with this line of code:

const match = await firstValueFrom(
  this.someStringObservable().pipe(find((g) => g === 'blah')),
);

...the match value resolves to undefined; EmptyError is not thrown.

Expected behavior

firstValueFrom should either match the documented behavior or the documentation should be fixed.

Reproduction code

const { from, firstValueFrom, find } = await import("rxjs");
const result = await firstValueFrom(from(['a', 'b', 'c']).pipe(find(x => x === 'd')));
console.log({ result });

Reproduction URL

No response

Version

7.8.1

Environment

No response

Additional context

No response

@jpage-godaddy
Copy link
Author

Sorry, invalid. Missed that find does emit an undefined value.

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

No branches or pull requests

1 participant