@ngrx/signals
Version:
Reactive Store and Set of Utilities for Angular Signals
13 lines (12 loc) • 880 B
TypeScript
import { Signal } from '@angular/core';
import { SignalStoreFeature, SignalStoreFeatureResult, StateSignals } from './signal-store-models';
import { Prettify } from './ts-helpers';
type ComputedResult<ComputedDictionary extends Record<string | symbol, Signal<unknown> | (() => unknown)>> = {
[P in keyof ComputedDictionary]: ComputedDictionary[P] extends Signal<unknown> ? ComputedDictionary[P] : ComputedDictionary[P] extends () => infer V ? Signal<V> : never;
};
export declare function withComputed<Input extends SignalStoreFeatureResult, ComputedDictionary extends Record<string | symbol, Signal<unknown> | (() => unknown)>>(computedFactory: (store: Prettify<StateSignals<Input['state']> & Input['props'] & Input['methods']>) => ComputedDictionary): SignalStoreFeature<Input, {
state: {};
props: ComputedResult<ComputedDictionary>;
methods: {};
}>;
export {};