1 | import { type ValueEqualityFn } from '@angular/core';
|
2 | export interface Action<Type extends string = string> {
|
3 | type: Type;
|
4 | }
|
5 | export type ActionType<A> = A extends ActionCreator<infer T, infer C> ? ReturnType<C> & {
|
6 | type: T;
|
7 | } : never;
|
8 | export type TypeId<T> = () => T;
|
9 | export type InitialState<T> = Partial<T> | TypeId<Partial<T>> | void;
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export interface ActionReducer<T, V extends Action = Action> {
|
15 | (state: T | undefined, action: V): T;
|
16 | }
|
17 | export type ActionReducerMap<T, V extends Action = Action> = {
|
18 | [p in keyof T]: ActionReducer<T[p], V>;
|
19 | };
|
20 | export interface ActionReducerFactory<T, V extends Action = Action> {
|
21 | (reducerMap: ActionReducerMap<T, V>, initialState?: InitialState<T>): ActionReducer<T, V>;
|
22 | }
|
23 | export type MetaReducer<T = any, V extends Action = Action> = (reducer: ActionReducer<T, V>) => ActionReducer<T, V>;
|
24 | export interface StoreFeature<T, V extends Action = Action> {
|
25 | key: string;
|
26 | reducers: ActionReducerMap<T, V> | ActionReducer<T, V>;
|
27 | reducerFactory: ActionReducerFactory<T, V>;
|
28 | initialState?: InitialState<T>;
|
29 | metaReducers?: MetaReducer<T, V>[];
|
30 | }
|
31 | export type Selector<T, V> = (state: T) => V;
|
32 |
|
33 |
|
34 |
|
35 | export type SelectorWithProps<State, Props, Result> = (state: State, props: Props) => Result;
|
36 | export declare const arraysAreNotAllowedMsg = "action creator cannot return an array";
|
37 | type ArraysAreNotAllowed = typeof arraysAreNotAllowedMsg;
|
38 | export declare const typePropertyIsNotAllowedMsg = "action creator cannot return an object with a property named `type`";
|
39 | type TypePropertyIsNotAllowed = typeof typePropertyIsNotAllowedMsg;
|
40 | export declare const emptyObjectsAreNotAllowedMsg = "action creator cannot return an empty object";
|
41 | type EmptyObjectsAreNotAllowed = typeof emptyObjectsAreNotAllowedMsg;
|
42 | export declare const arraysAreNotAllowedInProps = "action creator props cannot be an array";
|
43 | type ArraysAreNotAllowedInProps = typeof arraysAreNotAllowedInProps;
|
44 | export declare const typePropertyIsNotAllowedInProps = "action creator props cannot have a property named `type`";
|
45 | type TypePropertyIsNotAllowedInProps = typeof typePropertyIsNotAllowedInProps;
|
46 | export declare const emptyObjectsAreNotAllowedInProps = "action creator props cannot be an empty object";
|
47 | type EmptyObjectsAreNotAllowedInProps = typeof emptyObjectsAreNotAllowedInProps;
|
48 | export declare const primitivesAreNotAllowedInProps = "action creator props cannot be a primitive value";
|
49 | type PrimitivesAreNotAllowedInProps = typeof primitivesAreNotAllowedInProps;
|
50 | export type FunctionIsNotAllowed<T, ErrorMessage extends string> = T extends Function ? ErrorMessage : T;
|
51 |
|
52 |
|
53 |
|
54 | export type Creator<P extends any[] = any[], R extends object = object> = FunctionWithParametersType<P, R>;
|
55 | export type Primitive = string | number | bigint | boolean | symbol | null | undefined;
|
56 | export type NotAllowedCheck<T extends object> = T extends any[] ? ArraysAreNotAllowed : T extends {
|
57 | type: any;
|
58 | } ? TypePropertyIsNotAllowed : keyof T extends never ? EmptyObjectsAreNotAllowed : unknown;
|
59 | export type NotAllowedInPropsCheck<T> = T extends object ? T extends any[] ? ArraysAreNotAllowedInProps : T extends {
|
60 | type: any;
|
61 | } ? TypePropertyIsNotAllowedInProps : keyof T extends never ? EmptyObjectsAreNotAllowedInProps : unknown : T extends Primitive ? PrimitivesAreNotAllowedInProps : never;
|
62 |
|
63 |
|
64 |
|
65 | export type ActionCreator<T extends string = string, C extends Creator = Creator> = C & Action<T>;
|
66 | export interface ActionCreatorProps<T> {
|
67 | _as: 'props';
|
68 | _p: T;
|
69 | }
|
70 | export type FunctionWithParametersType<P extends unknown[], R = void> = (...args: P) => R;
|
71 | export interface RuntimeChecks {
|
72 | |
73 |
|
74 |
|
75 | strictStateSerializability: boolean;
|
76 | |
77 |
|
78 |
|
79 | strictActionSerializability: boolean;
|
80 | |
81 |
|
82 |
|
83 | strictStateImmutability: boolean;
|
84 | |
85 |
|
86 |
|
87 | strictActionImmutability: boolean;
|
88 | |
89 |
|
90 |
|
91 | strictActionWithinNgZone: boolean;
|
92 | |
93 |
|
94 |
|
95 | strictActionTypeUniqueness?: boolean;
|
96 | }
|
97 | export interface SelectSignalOptions<T> {
|
98 | |
99 |
|
100 |
|
101 | equal?: ValueEqualityFn<T>;
|
102 | }
|
103 | export type Prettify<T> = {
|
104 | [K in keyof T]: T[K];
|
105 | } & {};
|
106 | export {};
|