Closed
Description
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
Metadata
Metadata
Assignees
Labels
No labels