Skip to content

Commit 994d570

Browse files
perf(signals): remove symbol descriptions from prod bundle
1 parent 9a2a4ba commit 994d570

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

modules/signals/entities/src/helpers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
SelectEntityId,
88
} from './models';
99

10-
declare const ngDevMode: unknown;
1110
const defaultSelectId: SelectEntityId<{ id: EntityId }> = (entity) => entity.id;
1211

1312
export function getEntityIdSelector(config?: {

modules/signals/events/src/events-service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ import {
99
import { EventInstance } from './event-instance';
1010
import { EventCreator } from './event-creator';
1111

12-
export const EVENTS = Symbol();
13-
export const SOURCE_TYPE = Symbol();
12+
export const EVENTS = Symbol(
13+
typeof ngDevMode !== 'undefined' && ngDevMode ? 'EVENTS' : ''
14+
);
15+
export const SOURCE_TYPE = Symbol(
16+
typeof ngDevMode !== 'undefined' && ngDevMode ? 'SOURCE_TYPE' : ''
17+
);
1418

1519
abstract class BaseEvents {
1620
/**

modules/signals/rxjs-interop/src/rx-method.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import {
1010
} from '@angular/core';
1111
import { isObservable, noop, Observable, Subject } from 'rxjs';
1212

13-
declare const ngDevMode: unknown;
14-
1513
type RxMethodRef = {
1614
destroy: () => void;
1715
};

modules/signals/src/deep-signal.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { computed, isSignal, Signal, untracked } from '@angular/core';
22
import { IsKnownRecord } from './ts-helpers';
33

4-
const DEEP_SIGNAL = Symbol('DEEP_SIGNAL');
4+
const DEEP_SIGNAL = Symbol(
5+
typeof ngDevMode !== 'undefined' && ngDevMode ? 'DEEP_SIGNAL' : ''
6+
);
57

68
export type DeepSignal<T> = Signal<T> &
79
(IsKnownRecord<T> extends true

modules/signals/src/signal-method.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import {
1010
untracked,
1111
} from '@angular/core';
1212

13-
declare const ngDevMode: unknown;
14-
1513
export type SignalMethod<Input> = ((
1614
input: Input | Signal<Input>,
1715
config?: { injector?: Injector }

modules/signals/src/state-source.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import {
99
WritableSignal,
1010
} from '@angular/core';
1111

12-
declare const ngDevMode: unknown;
13-
1412
const STATE_WATCHERS = new WeakMap<object, Array<StateWatcher<any>>>();
1513

16-
export const STATE_SOURCE = Symbol('STATE_SOURCE');
14+
export const STATE_SOURCE = Symbol(
15+
typeof ngDevMode !== 'undefined' && ngDevMode ? 'STATE_SOURCE' : ''
16+
);
1717

1818
export type WritableStateSource<State extends object> = {
1919
[STATE_SOURCE]: { [K in keyof State]: WritableSignal<State[K]> };

0 commit comments

Comments
 (0)