@@ -47,11 +47,7 @@ export function getDefaultMiddleware(
47
47
/**
48
48
* Options for `configureStore()`.
49
49
*/
50
- export interface ConfigureStoreOptions <
51
- S = any ,
52
- A extends Action = AnyAction ,
53
- PS extends S = S
54
- > {
50
+ export interface ConfigureStoreOptions < S = any , A extends Action = AnyAction > {
55
51
/**
56
52
* A single reducer function that will be used as the root reducer, or an
57
53
* object of slice reducers that will be passed to `combineReducers()`.
@@ -76,7 +72,11 @@ export interface ConfigureStoreOptions<
76
72
* function (either directly or indirectly by passing an object as `reducer`),
77
73
* this must be an object with the same shape as the reducer map keys.
78
74
*/
79
- preloadedState ?: DeepPartial < PS >
75
+ // NOTE: The needlessly complicated `S extends any ? S : S` instead of just
76
+ // `S` ensures that the TypeScript compiler doesn't attempt to infer `S`
77
+ // based on the value passed as `preloadedState`, which might be a partial
78
+ // state rather than the full thing.
79
+ preloadedState ?: DeepPartial < S extends any ? S : S >
80
80
81
81
/**
82
82
* The store enhancers to apply. See Redux's `createStore()`. If you only
@@ -91,11 +91,9 @@ export interface ConfigureStoreOptions<
91
91
* @param config The store configuration.
92
92
* @returns A configured Redux store.
93
93
*/
94
- export function configureStore <
95
- S = any ,
96
- A extends Action = AnyAction ,
97
- PS extends S = S
98
- > ( options : ConfigureStoreOptions < S , A , PS > ) : Store < S , A > {
94
+ export function configureStore < S = any , A extends Action = AnyAction > (
95
+ options : ConfigureStoreOptions < S , A >
96
+ ) : Store < S , A > {
99
97
const {
100
98
reducer = undefined ,
101
99
middleware = getDefaultMiddleware ( ) ,
0 commit comments