Skip to content

Commit 6918d66

Browse files
committed
Mark new types as alpha
1 parent 08a256b commit 6918d66

File tree

4 files changed

+47
-10
lines changed

4 files changed

+47
-10
lines changed

etc/redux-toolkit.api.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export type CaseReducerWithPrepare<State, Action extends PayloadAction> = {
7777
prepare: PrepareAction<Action['payload']>;
7878
};
7979

80-
// @public (undocumented)
80+
// @alpha (undocumented)
8181
export type Comparer<T> = ComparerNum<T> | ComparerStr<T>;
8282

8383
// @public
@@ -101,7 +101,7 @@ export function createAction<P = void, T extends string = string>(type: T): Payl
101101
// @public
102102
export function createAction<PA extends PrepareAction<any>, T extends string = string>(type: T, prepareAction: PA): PayloadActionCreator<ReturnType<PA>['payload'], T, PA>;
103103

104-
// @public (undocumented)
104+
// @alpha (undocumented)
105105
export function createAsyncThunk<ActionType extends string, PayloadCreator extends AsyncActionCreator<unknown, Dispatch, unknown, undefined>>(type: ActionType, payloadCreator: PayloadCreator): {
106106
(args?: Parameters<PayloadCreator>[0]["args"] | undefined): (dispatch: any, getState: any, extra: any) => Promise<any>;
107107
pending: ActionCreatorWithPayload<{
@@ -120,7 +120,7 @@ export function createAsyncThunk<ActionType extends string, PayloadCreator exten
120120
}, string>;
121121
};
122122

123-
// @public (undocumented)
123+
// @alpha (undocumented)
124124
export function createEntityAdapter<T>(options?: {
125125
selectId?: IdSelector<T>;
126126
sortComparer?: false | Comparer<T>;
@@ -150,7 +150,7 @@ export interface CreateSliceOptions<State = any, CR extends SliceCaseReducers<St
150150
reducers: ValidateSliceCaseReducers<State, CR>;
151151
}
152152

153-
// @public (undocumented)
153+
// @alpha (undocumented)
154154
export abstract class Dictionary<T> implements DictionaryNum<T> {
155155
// (undocumented)
156156
[id: string]: T | undefined;
@@ -163,7 +163,7 @@ export interface EnhancedStore<S = any, A extends Action = AnyAction, M extends
163163
dispatch: DispatchForMiddlewares<M> & Dispatch<A>;
164164
}
165165

166-
// @public (undocumented)
166+
// @alpha (undocumented)
167167
export interface EntityAdapter<T> extends EntityStateAdapter<T> {
168168
// (undocumented)
169169
getInitialState(): EntityState<T>;
@@ -179,10 +179,10 @@ export interface EntityAdapter<T> extends EntityStateAdapter<T> {
179179
sortComparer: false | Comparer<T>;
180180
}
181181

182-
// @public (undocumented)
182+
// @alpha (undocumented)
183183
export type EntityMap<T> = (entity: T) => T;
184184

185-
// @public (undocumented)
185+
// @alpha (undocumented)
186186
export interface EntityState<T> {
187187
// (undocumented)
188188
entities: Dictionary<T>;
@@ -203,7 +203,7 @@ export function getDefaultMiddleware<S = any, O extends Partial<GetDefaultMiddle
203203
// @public
204204
export function getType<T extends string>(actionCreator: PayloadActionCreator<any, T>): T;
205205

206-
// @public (undocumented)
206+
// @alpha (undocumented)
207207
export type IdSelector<T> = IdSelectorStr<T> | IdSelectorNum<T>;
208208

209209
// @public
@@ -222,7 +222,7 @@ export type PayloadAction<P = void, T extends string = string, M = never, E = ne
222222
// @public
223223
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>>>>>>;
224224

225-
// @public (undocumented)
225+
// @alpha (undocumented)
226226
export type Predicate<T> = (entity: T) => boolean;
227227

228228
// @public
@@ -266,7 +266,7 @@ export type SliceCaseReducers<State> = {
266266

267267
export { ThunkAction }
268268

269-
// @public (undocumented)
269+
// @alpha (undocumented)
270270
export type Update<T> = UpdateStr<T> | UpdateNum<T>;
271271

272272
// @public

src/createAsyncThunk.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ export type AsyncActionCreator<
2626
E extends unknown
2727
> = (params: AsyncThunkParams<A, D, S, E>) => any
2828

29+
/**
30+
*
31+
* @param type
32+
* @param payloadCreator
33+
*
34+
* @alpha
35+
*/
2936
export function createAsyncThunk<
3037
ActionType extends string,
3138
PayloadCreator extends AsyncActionCreator<

src/entities/create_adapter.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { createSelectorsFactory } from './state_selectors'
44
import { createSortedStateAdapter } from './sorted_state_adapter'
55
import { createUnsortedStateAdapter } from './unsorted_state_adapter'
66

7+
/**
8+
*
9+
* @param options
10+
*
11+
* @alpha
12+
*/
713
export function createEntityAdapter<T>(
814
options: {
915
selectId?: IdSelector<T>

src/entities/models.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,26 @@ import { PayloadAction } from '../createAction'
33
export type ComparerStr<T> = (a: T, b: T) => string
44
export type ComparerNum<T> = (a: T, b: T) => number
55

6+
/**
7+
* @alpha
8+
*/
69
export type Comparer<T> = ComparerNum<T> | ComparerStr<T>
710

811
export type IdSelectorStr<T> = (model: T) => string
912
export type IdSelectorNum<T> = (model: T) => number
1013

14+
/**
15+
* @alpha
16+
*/
1117
export type IdSelector<T> = IdSelectorStr<T> | IdSelectorNum<T>
1218

1319
export interface DictionaryNum<T> {
1420
[id: number]: T | undefined
1521
}
1622

23+
/**
24+
* @alpha
25+
*/
1726
export abstract class Dictionary<T> implements DictionaryNum<T> {
1827
[id: string]: T | undefined
1928
}
@@ -28,14 +37,26 @@ export interface UpdateNum<T> {
2837
changes: Partial<T>
2938
}
3039

40+
/**
41+
* @alpha
42+
*/
3143
export type Update<T> = UpdateStr<T> | UpdateNum<T>
3244

45+
/**
46+
* @alpha
47+
*/
3348
export type Predicate<T> = (entity: T) => boolean
3449

50+
/**
51+
* @alpha
52+
*/
3553
export type EntityMap<T> = (entity: T) => T
3654

3755
export type TypeOrPayloadAction<T> = T | PayloadAction<T>
3856

57+
/**
58+
* @alpha
59+
*/
3960
export interface EntityState<T> {
4061
ids: string[] | number[]
4162
entities: Dictionary<T>
@@ -111,6 +132,9 @@ export interface EntitySelectors<T, V> {
111132
selectTotal: (state: V) => number
112133
}
113134

135+
/**
136+
* @alpha
137+
*/
114138
export interface EntityAdapter<T> extends EntityStateAdapter<T> {
115139
selectId: IdSelector<T>
116140
sortComparer: false | Comparer<T>

0 commit comments

Comments
 (0)