diff --git a/goldens/public-api/core/rxjs-interop/index.api.md b/goldens/public-api/core/rxjs-interop/index.api.md index 02ff5112de8b..49b13da7c1b0 100644 --- a/goldens/public-api/core/rxjs-interop/index.api.md +++ b/goldens/public-api/core/rxjs-interop/index.api.md @@ -84,7 +84,6 @@ export interface ToSignalOptions { initialValue?: unknown; injector?: Injector; manualCleanup?: boolean; - rejectErrors?: boolean; requireSync?: boolean; } diff --git a/packages/core/rxjs-interop/src/to_signal.ts b/packages/core/rxjs-interop/src/to_signal.ts index c33872a79cfb..8a565330d93a 100644 --- a/packages/core/rxjs-interop/src/to_signal.ts +++ b/packages/core/rxjs-interop/src/to_signal.ts @@ -62,16 +62,6 @@ export interface ToSignalOptions { */ manualCleanup?: boolean; - /** - * Whether `toSignal` should throw errors from the Observable error channel back to RxJS, where - * they'll be processed as uncaught exceptions. - * - * In practice, this means that the signal returned by `toSignal` will keep returning the last - * good value forever, as Observables which error produce no further values. This option emulates - * the behavior of the `async` pipe. - */ - rejectErrors?: boolean; - /** * A comparison function which defines equality for values emitted by the observable. * @@ -172,11 +162,6 @@ export function toSignal( const sub = source.subscribe({ next: (value) => state.set({kind: StateKind.Value, value}), error: (error) => { - if (options?.rejectErrors) { - // Kick the error back to RxJS. It will be caught and rethrown in a macrotask, which causes - // the error to end up as an uncaught exception. - throw error; - } state.set({kind: StateKind.Error, error}); }, // Completion of the Observable is meaningless to the signal. Signals don't have a concept of diff --git a/packages/core/rxjs-interop/test/to_signal_spec.ts b/packages/core/rxjs-interop/test/to_signal_spec.ts index 807b04bd2db1..8b76cfb76c7b 100644 --- a/packages/core/rxjs-interop/test/to_signal_spec.ts +++ b/packages/core/rxjs-interop/test/to_signal_spec.ts @@ -152,28 +152,6 @@ describe('toSignal()', () => { ); }); - it('should throw the error back to RxJS if rejectErrors is set', () => { - let capturedObserver: Observer = null!; - const fake$ = { - subscribe(observer: Observer): Unsubscribable { - capturedObserver = observer; - return {unsubscribe(): void {}}; - }, - } as Subscribable; - - const s = toSignal(fake$, {initialValue: 0, rejectErrors: true, manualCleanup: true}); - expect(s()).toBe(0); - if (capturedObserver === null) { - return fail('Observer not captured as expected.'); - } - - capturedObserver.next(1); - expect(s()).toBe(1); - - expect(() => capturedObserver.error('test')).toThrow('test'); - expect(s()).toBe(1); - }); - describe('with no initial value', () => { it( 'should return `undefined` if read before a value is emitted',