Skip to content

Commit fe41b11

Browse files
crisbetoatscott
authored andcommitted
fix(core): tree shake dev mode error message (#57035)
Adds an `ngDevMode` check before a runtime error message. Fixes #57034. PR Close #57035
1 parent 21f7131 commit fe41b11

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/core/rxjs-interop/src/to_signal.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,11 @@ export function toSignal<T, U = undefined>(
183183
// "complete".
184184
});
185185

186-
if (ngDevMode && options?.requireSync && state().kind === StateKind.NoValue) {
186+
if (options?.requireSync && state().kind === StateKind.NoValue) {
187187
throw new ɵRuntimeError(
188188
ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,
189-
'`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',
189+
(typeof ngDevMode === 'undefined' || ngDevMode) &&
190+
'`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',
190191
);
191192
}
192193

@@ -205,10 +206,10 @@ export function toSignal<T, U = undefined>(
205206
throw current.error;
206207
case StateKind.NoValue:
207208
// This shouldn't really happen because the error is thrown on creation.
208-
// TODO(alxhub): use a RuntimeError when we finalize the error semantics
209209
throw new ɵRuntimeError(
210210
ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,
211-
'`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',
211+
(typeof ngDevMode === 'undefined' || ngDevMode) &&
212+
'`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',
212213
);
213214
}
214215
},

0 commit comments

Comments
 (0)