@@ -6,15 +6,14 @@ import type {
6
6
Reducer ,
7
7
Store ,
8
8
Action ,
9
- StoreEnhancer
9
+ StoreEnhancer ,
10
10
} from 'redux'
11
11
import { applyMiddleware } from 'redux'
12
- import type { PayloadAction ,
13
- ConfigureStoreOptions } from '@reduxjs/toolkit'
12
+ import type { PayloadAction , ConfigureStoreOptions } from '@reduxjs/toolkit'
14
13
import {
15
14
configureStore ,
16
15
getDefaultMiddleware ,
17
- createSlice
16
+ createSlice ,
18
17
} from '@reduxjs/toolkit'
19
18
import type { ThunkMiddleware , ThunkAction , ThunkDispatch } from 'redux-thunk'
20
19
import thunk from 'redux-thunk'
@@ -144,10 +143,12 @@ const _anyMiddleware: any = () => () => () => {}
144
143
{
145
144
const store = configureStore ( {
146
145
reducer : ( ) => 0 ,
147
- enhancers : [ applyMiddleware ( ( ) => next => next ) ]
146
+ enhancers : [ applyMiddleware ( ( ) => ( next ) => next ) ] ,
148
147
} )
149
148
150
- expectType < Dispatch & ThunkDispatch < number , undefined , AnyAction > > ( store . dispatch )
149
+ expectType < Dispatch & ThunkDispatch < number , undefined , AnyAction > > (
150
+ store . dispatch
151
+ )
151
152
}
152
153
153
154
configureStore ( {
@@ -159,7 +160,7 @@ const _anyMiddleware: any = () => () => () => {}
159
160
{
160
161
type SomePropertyStoreEnhancer = StoreEnhancer < { someProperty : string } >
161
162
162
- const somePropertyStoreEnhancer : SomePropertyStoreEnhancer = next => {
163
+ const somePropertyStoreEnhancer : SomePropertyStoreEnhancer = ( next ) => {
163
164
return ( reducer , preloadedState ) => {
164
165
return {
165
166
...next ( reducer , preloadedState ) ,
@@ -168,9 +169,13 @@ const _anyMiddleware: any = () => () => () => {}
168
169
}
169
170
}
170
171
171
- type AnotherPropertyStoreEnhancer = StoreEnhancer < { anotherProperty : number } >
172
+ type AnotherPropertyStoreEnhancer = StoreEnhancer < {
173
+ anotherProperty : number
174
+ } >
172
175
173
- const anotherPropertyStoreEnhancer : AnotherPropertyStoreEnhancer = next => {
176
+ const anotherPropertyStoreEnhancer : AnotherPropertyStoreEnhancer = (
177
+ next
178
+ ) => {
174
179
return ( reducer , preloadedState ) => {
175
180
return {
176
181
...next ( reducer , preloadedState ) ,
@@ -184,7 +189,9 @@ const _anyMiddleware: any = () => () => () => {}
184
189
enhancers : [ somePropertyStoreEnhancer , anotherPropertyStoreEnhancer ] ,
185
190
} )
186
191
187
- expectType < Dispatch & ThunkDispatch < number , undefined , AnyAction > > ( store . dispatch )
192
+ expectType < Dispatch & ThunkDispatch < number , undefined , AnyAction > > (
193
+ store . dispatch
194
+ )
188
195
expectType < string > ( store . someProperty )
189
196
expectType < number > ( store . anotherProperty )
190
197
}
@@ -348,7 +355,9 @@ const _anyMiddleware: any = () => () => () => {}
348
355
{
349
356
const store = configureStore ( {
350
357
reducer : reducerA ,
351
- middleware : [ ] as any as readonly [ Middleware < ( a : StateA ) => boolean , StateA > ] ,
358
+ middleware : [ ] as any as readonly [
359
+ Middleware < ( a : StateA ) => boolean , StateA >
360
+ ] ,
352
361
} )
353
362
const result : boolean = store . dispatch ( 5 )
354
363
// @ts -expect-error
@@ -532,21 +541,23 @@ const _anyMiddleware: any = () => () => () => {}
532
541
initialState : null as any ,
533
542
reducers : {
534
543
set ( state ) {
535
- return state ;
544
+ return state
536
545
} ,
537
546
} ,
538
- } ) ;
547
+ } )
539
548
540
- function configureMyStore < S > ( options : Omit < ConfigureStoreOptions < S > , 'reducer' > ) {
549
+ function configureMyStore < S > (
550
+ options : Omit < ConfigureStoreOptions < S > , 'reducer' >
551
+ ) {
541
552
return configureStore ( {
542
553
...options ,
543
554
reducer : someSlice . reducer ,
544
- } ) ;
555
+ } )
545
556
}
546
557
547
- const store = configureMyStore ( { } ) ;
558
+ const store = configureMyStore ( { } )
548
559
549
- expectType < Function > ( store . dispatch ) ;
560
+ expectType < Function > ( store . dispatch )
550
561
}
551
562
552
563
{
0 commit comments