Skip to content

Commit b2a5105

Browse files
authored
Merge pull request #3170 from reduxjs/feature/2.0-redux-alpha-dep
2 parents 803c970 + 2c4d418 commit b2a5105

File tree

7 files changed

+32
-18
lines changed

7 files changed

+32
-18
lines changed

packages/toolkit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
],
119119
"dependencies": {
120120
"immer": "^9.0.16",
121-
"redux": "^4.2.0",
121+
"redux": "5.0.0-alpha.2",
122122
"redux-thunk": "3.0.0-alpha.1",
123123
"reselect": "^4.1.7"
124124
},

packages/toolkit/scripts/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ async function bundle(options: BuildOptions & EntryPointOptions) {
209209
],
210210
})
211211

212-
for (const chunk of result.outputFiles) {
212+
for (const chunk of result.outputFiles!) {
213213
const esVersion =
214214
target in esVersionMappings
215215
? esVersionMappings[target]
@@ -252,7 +252,7 @@ async function bundle(options: BuildOptions & EntryPointOptions) {
252252
toplevel: true,
253253
}
254254
)
255-
code = transformResult.code
255+
code = transformResult.code!
256256
mapping = transformResult.map as RawSourceMap
257257
}
258258

packages/toolkit/src/devtoolsExtension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ type Compose = typeof compose
220220

221221
interface ComposeWithDevTools {
222222
(options: DevToolsEnhancerOptions): Compose
223-
<StoreExt>(...funcs: StoreEnhancer<StoreExt>[]): StoreEnhancer<StoreExt>
223+
<StoreExt extends {}>(
224+
...funcs: StoreEnhancer<StoreExt>[]
225+
): StoreEnhancer<StoreExt>
224226
}
225227

226228
/**

packages/toolkit/src/tests/configureStore.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ describe('configureStore', async () => {
270270
let dummyEnhancerCalled = false
271271

272272
const dummyEnhancer: StoreEnhancer =
273-
(createStore: StoreEnhancerStoreCreator) =>
273+
(createStore) =>
274274
(reducer, ...args: any[]) => {
275275
dummyEnhancerCalled = true
276276

packages/toolkit/src/tests/configureStore.typetest.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ const _anyMiddleware: any = () => () => () => {}
159159
})
160160

161161
{
162-
type SomePropertyStoreEnhancer = StoreEnhancer<{ someProperty: string }>
163-
164-
const somePropertyStoreEnhancer: SomePropertyStoreEnhancer = (next) => {
162+
const somePropertyStoreEnhancer: StoreEnhancer<{ someProperty: string }> = (
163+
next
164+
) => {
165165
return (reducer, preloadedState) => {
166166
return {
167167
...next(reducer, preloadedState),
@@ -170,13 +170,9 @@ const _anyMiddleware: any = () => () => () => {}
170170
}
171171
}
172172

173-
type AnotherPropertyStoreEnhancer = StoreEnhancer<{
173+
const anotherPropertyStoreEnhancer: StoreEnhancer<{
174174
anotherProperty: number
175-
}>
176-
177-
const anotherPropertyStoreEnhancer: AnotherPropertyStoreEnhancer = (
178-
next
179-
) => {
175+
}> = (next) => {
180176
return (reducer, preloadedState) => {
181177
return {
182178
...next(reducer, preloadedState),
@@ -187,7 +183,10 @@ const _anyMiddleware: any = () => () => () => {}
187183

188184
const store = configureStore({
189185
reducer: () => 0,
190-
enhancers: [somePropertyStoreEnhancer, anotherPropertyStoreEnhancer],
186+
enhancers: [
187+
somePropertyStoreEnhancer,
188+
anotherPropertyStoreEnhancer,
189+
] as const,
191190
})
192191

193192
expectType<Dispatch & ThunkDispatch<number, undefined, AnyAction>>(

packages/toolkit/src/tsHelpers.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,14 @@ export type ExtractDispatchExtensions<M> = M extends MiddlewareArray<
101101
? ExtractDispatchFromMiddlewareTuple<[...M], {}>
102102
: never
103103

104-
export type ExtractStoreExtensions<E> = E extends any[]
105-
? UnionToIntersection<E[number] extends StoreEnhancer<infer Ext> ? Ext extends {} ? Ext : {} : {}>
104+
export type ExtractStoreExtensions<E> = E extends readonly any[]
105+
? UnionToIntersection<
106+
E[number] extends StoreEnhancer<infer Ext>
107+
? Ext extends {}
108+
? Ext
109+
: {}
110+
: {}
111+
>
106112
: {}
107113

108114
/**

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6781,7 +6781,7 @@ __metadata:
67816781
node-fetch: ^2.6.1
67826782
prettier: ^2.2.1
67836783
query-string: ^7.0.1
6784-
redux: ^4.2.0
6784+
redux: 5.0.0-alpha.2
67856785
redux-thunk: 3.0.0-alpha.1
67866786
reselect: ^4.1.7
67876787
rimraf: ^3.0.2
@@ -24426,6 +24426,13 @@ fsevents@^1.2.7:
2442624426
languageName: node
2442724427
linkType: hard
2442824428

24429+
"redux@npm:5.0.0-alpha.2":
24430+
version: 5.0.0-alpha.2
24431+
resolution: "redux@npm:5.0.0-alpha.2"
24432+
checksum: fbae31c55bab62a210a5a24a64721f593080fb94808c547b646ddff91515f8ab4e3363af5ece16491f0179d43729fc0350235c9fea7500b37b67d762a55b6945
24433+
languageName: node
24434+
linkType: hard
24435+
2442924436
"redux@npm:^4.0.0, redux@npm:^4.1.2":
2443024437
version: 4.1.2
2443124438
resolution: "redux@npm:4.1.2"

0 commit comments

Comments
 (0)