Skip to content

Commit 587a85b

Browse files
committed
Export thunk and withExtraArgument as named values and remove defaults
1 parent b96589c commit 587a85b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function createThunkMiddleware<
3636
return middleware
3737
}
3838

39-
const thunk = createThunkMiddleware() as ThunkMiddleware & {
39+
export const thunk = createThunkMiddleware() as ThunkMiddleware & {
4040
withExtraArgument<
4141
ExtraThunkArg,
4242
State = any,
@@ -46,8 +46,6 @@ const thunk = createThunkMiddleware() as ThunkMiddleware & {
4646
): ThunkMiddleware<State, BasicAction, ExtraThunkArg>
4747
}
4848

49-
// Attach the factory function so users can create a customized version
49+
// Export the factory function so users can create a customized version
5050
// with whatever "extra arg" they want to inject into their thunks
51-
thunk.withExtraArgument = createThunkMiddleware
52-
53-
export default thunk
51+
export const withExtraArgument = createThunkMiddleware

test/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import thunkMiddleware from '../src/index'
1+
import { thunk as thunkMiddleware, withExtraArgument } from '../src/index'
22

33
describe('thunk middleware', () => {
44
const doDispatch = () => {}
@@ -92,7 +92,7 @@ describe('thunk middleware', () => {
9292
it('must pass the third argument', done => {
9393
const extraArg = { lol: true }
9494
// @ts-ignore
95-
thunkMiddleware.withExtraArgument(extraArg)({
95+
withExtraArgument(extraArg)({
9696
dispatch: doDispatch,
9797
getState: doGetState
9898
})()((dispatch: any, getState: any, arg: any) => {

0 commit comments

Comments
 (0)