@@ -77,6 +77,9 @@ export type CaseReducerWithPrepare<State, Action extends PayloadAction> = {
77
77
prepare: PrepareAction <Action [' payload' ]>;
78
78
};
79
79
80
+ // @public (undocumented)
81
+ export type Comparer <T > = ComparerNum <T > | ComparerStr <T >;
82
+
80
83
// @public
81
84
export type ConfigureEnhancersCallback = (defaultEnhancers : StoreEnhancer []) => StoreEnhancer [];
82
85
@@ -98,6 +101,12 @@ export function createAction<P = void, T extends string = string>(type: T): Payl
98
101
// @public
99
102
export function createAction<PA extends PrepareAction <any >, T extends string = string >(type : T , prepareAction : PA ): PayloadActionCreator <ReturnType <PA >[' payload' ], T , PA >;
100
103
104
+ // @public (undocumented)
105
+ export function createEntityAdapter<T >(options ? : {
106
+ selectId? : IdSelector <T >;
107
+ sortComparer? : false | Comparer <T >;
108
+ }): EntityAdapter <T >;
109
+
101
110
export { createNextState }
102
111
103
112
// @public
@@ -122,13 +131,46 @@ export interface CreateSliceOptions<State = any, CR extends SliceCaseReducers<St
122
131
reducers: ValidateSliceCaseReducers <State , CR >;
123
132
}
124
133
134
+ // @public (undocumented)
135
+ export abstract class Dictionary <T > implements DictionaryNum <T > {
136
+ // (undocumented)
137
+ [id : string ]: T | undefined ;
138
+ }
139
+
125
140
export { Draft }
126
141
127
142
// @public
128
143
export interface EnhancedStore <S = any , A extends Action = AnyAction , M extends Middlewares <S > = Middlewares <S >> extends Store <S , A > {
129
144
dispatch: DispatchForMiddlewares <M > & Dispatch <A >;
130
145
}
131
146
147
+ // @public (undocumented)
148
+ export interface EntityAdapter <T > extends EntityStateAdapter <T > {
149
+ // (undocumented)
150
+ getInitialState(): EntityState <T >;
151
+ // (undocumented)
152
+ getInitialState<S extends object >(state : S ): EntityState <T > & S ;
153
+ // (undocumented)
154
+ getSelectors(): EntitySelectors <T , EntityState <T >>;
155
+ // (undocumented)
156
+ getSelectors<V >(selectState : (state : V ) => EntityState <T >): EntitySelectors <T , V >;
157
+ // (undocumented)
158
+ selectId: IdSelector <T >;
159
+ // (undocumented)
160
+ sortComparer: false | Comparer <T >;
161
+ }
162
+
163
+ // @public (undocumented)
164
+ export type EntityMap <T > = (entity : T ) => T ;
165
+
166
+ // @public (undocumented)
167
+ export interface EntityState <T > {
168
+ // (undocumented)
169
+ entities: Dictionary <T >;
170
+ // (undocumented)
171
+ ids: string [] | number [];
172
+ }
173
+
132
174
// @public (undocumented)
133
175
export function findNonSerializableValue(value : unknown , path ? : ReadonlyArray <string >, isSerializable ? : (value : unknown ) => boolean , getEntries ? : (value : unknown ) => [string , any ][], ignoredPaths ? : string []): NonSerializableValue | false ;
134
176
@@ -142,6 +184,9 @@ export function getDefaultMiddleware<S = any, O extends Partial<GetDefaultMiddle
142
184
// @public
143
185
export function getType<T extends string >(actionCreator : PayloadActionCreator <any , T >): T ;
144
186
187
+ // @public (undocumented)
188
+ export type IdSelector <T > = IdSelectorStr <T > | IdSelectorNum <T >;
189
+
145
190
// @public
146
191
export function isPlain(val : any ): boolean ;
147
192
@@ -158,6 +203,9 @@ export type PayloadAction<P = void, T extends string = string, M = never, E = ne
158
203
// @public
159
204
export type PayloadActionCreator <P = void , T extends string = string , PA extends PrepareAction <P > | void = void > = IfPrepareActionMethodProvided <PA , _ActionCreatorWithPreparedPayload <PA , T >, IsAny <P , ActionCreatorWithPayload <any , T >, IsUnknownOrNonInferrable <P , ActionCreatorWithNonInferrablePayload <T >, IfVoid <P , ActionCreatorWithoutPayload <T >, IfMaybeUndefined <P , ActionCreatorWithOptionalPayload <P , T >, ActionCreatorWithPayload <P , T >>>>>>;
160
205
206
+ // @public (undocumented)
207
+ export type Predicate <T > = (entity : T ) => boolean ;
208
+
161
209
// @public
162
210
export type PrepareAction <P > = ((... args : any []) => {
163
211
payload: P ;
@@ -199,6 +247,9 @@ export type SliceCaseReducers<State> = {
199
247
200
248
export { ThunkAction }
201
249
250
+ // @public (undocumented)
251
+ export type Update <T > = UpdateStr <T > | UpdateNum <T >;
252
+
202
253
// @public
203
254
export type ValidateSliceCaseReducers <S , ACR extends SliceCaseReducers <S >> = ACR & {
204
255
[P in keyof ACR ]: ACR [P ] extends {
0 commit comments