Skip to content

Commit 2e211b7

Browse files
cellogtimdorr
authored andcommitted
migrate test helpers to typescript (reduxjs#3515)
Former-commit-id: 82d5a48 Former-commit-id: a06f235
1 parent d4083c1 commit 2e211b7

7 files changed

+14
-6
lines changed

test/helpers/actionCreators.js.REMOVED.git-id

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
46964ea9cef1aec64487cde982fc7450877410d7
File renamed without changes.

test/helpers/middleware.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/helpers/middleware.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { MiddlewareAPI, Dispatch, AnyAction } from '../..'
2+
3+
type ThunkAction<T extends any = any> = T extends AnyAction
4+
? AnyAction
5+
: T extends Function
6+
? T
7+
: never
8+
9+
export function thunk({ dispatch, getState }: MiddlewareAPI) {
10+
return (next: Dispatch) => <T>(action: ThunkAction) =>
11+
typeof action === 'function' ? action(dispatch, getState) : next(action)
12+
}

test/helpers/reducers.js.REMOVED.git-id

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c10d3d017ed4b5122d25d5ed2b80309ccadf7cf9

0 commit comments

Comments
 (0)