@ngrx/signals
Advanced tools
Comparing version 17.0.0-rc.0 to 17.0.0
{ | ||
"name": "@ngrx/signals", | ||
"version": "17.0.0-rc.0", | ||
"version": "17.0.0", | ||
"description": "Reactive State Management with Angular Signals", | ||
@@ -5,0 +5,0 @@ "repository": { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.platformVersion = void 0; | ||
exports.platformVersion = '^17.0.0-rc.0'; | ||
exports.platformVersion = '^17.0.0'; | ||
//# sourceMappingURL=libs-version.js.map |
@@ -1,6 +0,11 @@ | ||
import { Signal } from '@angular/core'; | ||
import { IsUnknownRecord } from './ts-helpers'; | ||
export type DeepSignal<T> = Signal<T> & (T extends Record<string, unknown> ? IsUnknownRecord<T> extends true ? unknown : Readonly<{ | ||
[K in keyof T]: T[K] extends Record<string, unknown> ? IsUnknownRecord<T[K]> extends true ? Signal<T[K]> : DeepSignal<T[K]> : Signal<T[K]>; | ||
import { Signal as NgSignal } from '@angular/core'; | ||
import { IsKnownRecord } from './ts-helpers'; | ||
interface Signal<T> extends NgSignal<T> { | ||
name: unknown; | ||
length: unknown; | ||
} | ||
export type DeepSignal<T> = Signal<T> & (IsKnownRecord<T> extends true ? Readonly<{ | ||
[K in keyof T]: IsKnownRecord<T[K]> extends true ? DeepSignal<T[K]> : Signal<T[K]>; | ||
}> : unknown); | ||
export declare function toDeepSignal<T>(signal: Signal<T>): DeepSignal<T>; | ||
export {}; |
import { SignalStateMeta } from './signal-state'; | ||
export declare function getState<State extends Record<string, unknown>>(signalState: SignalStateMeta<State>): State; | ||
export declare function getState<State extends object>(signalState: SignalStateMeta<State>): State; |
import { SignalStateMeta } from './signal-state'; | ||
export type PartialStateUpdater<State extends Record<string, unknown>> = (state: State) => Partial<State>; | ||
export declare function patchState<State extends Record<string, unknown>>(signalState: SignalStateMeta<State>, ...updaters: Array<Partial<State & {}> | PartialStateUpdater<State & {}>>): void; | ||
export type PartialStateUpdater<State extends object> = (state: State) => Partial<State>; | ||
export declare function patchState<State extends object>(signalState: SignalStateMeta<State>, ...updaters: Array<Partial<State & {}> | PartialStateUpdater<State & {}>>): void; |
import { WritableSignal } from '@angular/core'; | ||
import { DeepSignal } from './deep-signal'; | ||
import { HasFunctionKeys } from './ts-helpers'; | ||
export declare const STATE_SIGNAL: unique symbol; | ||
export type SignalStateMeta<State extends Record<string, unknown>> = { | ||
export type SignalStateMeta<State extends object> = { | ||
[STATE_SIGNAL]: WritableSignal<State>; | ||
}; | ||
type SignalStateCheck<State> = HasFunctionKeys<State> extends false | undefined ? unknown : '@ngrx/signals: signal state cannot contain `Function` property or method names'; | ||
type SignalState<State extends Record<string, unknown>> = DeepSignal<State> & SignalStateMeta<State>; | ||
export declare function signalState<State extends Record<string, unknown>>(initialState: State & SignalStateCheck<State>): SignalState<State>; | ||
type SignalState<State extends object> = DeepSignal<State> & SignalStateMeta<State>; | ||
export declare function signalState<State extends object>(initialState: State): SignalState<State>; | ||
export {}; |
import { Signal } from '@angular/core'; | ||
import { DeepSignal } from './deep-signal'; | ||
import { SignalStateMeta } from './signal-state'; | ||
import { IsUnknownRecord, Prettify } from './ts-helpers'; | ||
import { IsKnownRecord, Prettify } from './ts-helpers'; | ||
export type SignalStoreConfig = { | ||
providedIn: 'root'; | ||
}; | ||
export type SignalStoreSlices<State> = { | ||
[Key in keyof State]: State[Key] extends Record<string, unknown> ? IsUnknownRecord<State[Key]> extends true ? Signal<State[Key]> : DeepSignal<State[Key]> : Signal<State[Key]>; | ||
}; | ||
export type SignalStoreSlices<State> = IsKnownRecord<Prettify<State>> extends true ? { | ||
[Key in keyof State]: IsKnownRecord<State[Key]> extends true ? DeepSignal<State[Key]> : Signal<State[Key]>; | ||
} : {}; | ||
export type SignalStore<FeatureResult extends SignalStoreFeatureResult> = Prettify<SignalStoreSlices<FeatureResult['state']> & FeatureResult['signals'] & FeatureResult['methods'] & SignalStateMeta<Prettify<FeatureResult['state']>>>; | ||
@@ -18,3 +18,3 @@ export type SignalsDictionary = Record<string, Signal<unknown>>; | ||
}; | ||
export type InnerSignalStore<State extends Record<string, unknown> = Record<string, unknown>, Signals extends SignalsDictionary = SignalsDictionary, Methods extends MethodsDictionary = MethodsDictionary> = { | ||
export type InnerSignalStore<State extends object = object, Signals extends SignalsDictionary = SignalsDictionary, Methods extends MethodsDictionary = MethodsDictionary> = { | ||
slices: SignalStoreSlices<State>; | ||
@@ -26,3 +26,3 @@ signals: Signals; | ||
export type SignalStoreFeatureResult = { | ||
state: Record<string, unknown>; | ||
state: object; | ||
signals: SignalsDictionary; | ||
@@ -29,0 +29,0 @@ methods: MethodsDictionary; |
export type Prettify<T> = { | ||
[K in keyof T]: T[K]; | ||
} & {}; | ||
export type IsRecord<T> = T extends object ? T extends unknown[] ? false : T extends Set<unknown> ? false : T extends Map<unknown, unknown> ? false : T extends Function ? false : true : false; | ||
export type IsUnknownRecord<T> = string extends keyof T ? true : number extends keyof T ? true : false; | ||
export type HasOptionalProps<T> = T extends Required<T> ? false : true; | ||
export type HasFunctionKeys<T> = T extends Record<string, unknown> ? { | ||
[K in keyof T]: K extends keyof Function ? true : HasFunctionKeys<T[K]>; | ||
}[keyof T] : false; | ||
export type HasNestedFunctionKeys<T> = { | ||
[K in keyof T]: HasFunctionKeys<T[K]>; | ||
}[keyof T]; | ||
export type IsKnownRecord<T> = IsRecord<T> extends true ? IsUnknownRecord<T> extends true ? false : true : false; |
import { EmptyFeatureResult, SignalStoreFeature } from './signal-store-models'; | ||
import { HasNestedFunctionKeys, HasOptionalProps, IsUnknownRecord } from './ts-helpers'; | ||
type WithStateCheck<State> = IsUnknownRecord<State> extends true ? '@ngrx/signals: root state keys must be string literals' : HasOptionalProps<State> extends true ? '@ngrx/signals: root state slices cannot be optional' : HasNestedFunctionKeys<State> extends false | undefined ? unknown : '@ngrx/signals: nested state slices cannot contain `Function` property or method names'; | ||
export declare function withState<State extends Record<string, unknown>>(state: State & WithStateCheck<State>): SignalStoreFeature<EmptyFeatureResult, EmptyFeatureResult & { | ||
export declare function withState<State extends object>(stateFactory: () => State): SignalStoreFeature<EmptyFeatureResult, EmptyFeatureResult & { | ||
state: State; | ||
}>; | ||
export declare function withState<State extends Record<string, unknown>>(stateFactory: () => State & WithStateCheck<State>): SignalStoreFeature<EmptyFeatureResult, EmptyFeatureResult & { | ||
export declare function withState<State extends object>(state: State): SignalStoreFeature<EmptyFeatureResult, EmptyFeatureResult & { | ||
state: State; | ||
}>; | ||
export {}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
472168
3409