@ngrx/signals 19.0.0 → 19.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ export type StateSource<State extends object> = {
9
9
  };
10
10
  export type PartialStateUpdater<State extends object> = (state: State) => Partial<State>;
11
11
  export type StateWatcher<State extends object> = (state: NoInfer<State>) => void;
12
+ export declare function isWritableStateSource<State extends object>(stateSource: StateSource<State>): stateSource is WritableStateSource<State>;
12
13
  export declare function patchState<State extends object>(stateSource: WritableStateSource<State>, ...updaters: Array<Partial<Prettify<State>> | PartialStateUpdater<Prettify<State>>>): void;
13
14
  export declare function getState<State extends object>(stateSource: StateSource<State>): State;
14
15
  export declare function watchState<State extends object>(stateSource: StateSource<State>, watcher: StateWatcher<State>, config?: {
@@ -0,0 +1,25 @@
1
+ import { SignalStoreFeature, SignalStoreFeatureResult, StateSignals } from './signal-store-models';
2
+ import { Prettify } from './ts-helpers';
3
+ /**
4
+ * @description
5
+ * Allows passing properties, methods, or signals from a SignalStore
6
+ * to a feature.
7
+ *
8
+ * @usageNotes
9
+ * ```typescript
10
+ * signalStore(
11
+ * withMethods((store) => ({
12
+ * load(id: number): Observable<Entity> {
13
+ * return of({ id, name: 'John' });
14
+ * },
15
+ * })),
16
+ * withFeature(
17
+ * // 👇 has full access to the store
18
+ * (store) => withEntityLoader((id) => firstValueFrom(store.load(id)))
19
+ * )
20
+ * );
21
+ * ```
22
+ *
23
+ * @param featureFactory function returning the actual feature
24
+ */
25
+ export declare function withFeature<Input extends SignalStoreFeatureResult, Output extends SignalStoreFeatureResult>(featureFactory: (store: Prettify<StateSignals<Input['state']> & Input['props'] & Input['methods']>) => SignalStoreFeature<Input, Output>): SignalStoreFeature<Input, Output>;
@@ -0,0 +1 @@
1
+ export * from './src/index';
@@ -0,0 +1 @@
1
+ export { unprotected } from './unprotected';
@@ -0,0 +1,4 @@
1
+ import { Prettify, StateSource, WritableStateSource } from '@ngrx/signals';
2
+ type UnprotectedSource<Source extends StateSource<object>> = Source extends StateSource<infer State> ? Prettify<Omit<Source, keyof StateSource<State>> & WritableStateSource<State>> : never;
3
+ export declare function unprotected<Source extends StateSource<object>>(source: Source): UnprotectedSource<Source>;
4
+ export {};
@@ -1,2 +0,0 @@
1
- export declare function deepFreeze<T>(target: T): T;
2
- export declare function freezeInDevMode<T>(target: T): T;