Skip to content

Commit b9278d1

Browse files
committed
Fix typescript tests for new d.ts
1 parent 1e9529b commit b9278d1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

test/typescript/dispatch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const dispatchResult: Action = dispatch({type: 'TYPE'});
77

88
// thunk
99
declare module "../../" {
10-
export interface Dispatch<S> {
11-
<R>(asyncAction: (dispatch: Dispatch<S>, getState: () => S) => R): R;
10+
export interface Dispatch<D = Action> {
11+
<R>(asyncAction: (dispatch: Dispatch<D>, getState: () => D) => R): R;
1212
}
1313
}
1414

test/typescript/middleware.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import {
44
} from "../../"
55

66
declare module "../../" {
7-
export interface Dispatch<S> {
8-
<R>(asyncAction: (dispatch: Dispatch<S>, getState: () => S) => R): R;
7+
export interface Dispatch<D> {
8+
<R,S>(asyncAction: (dispatch: Dispatch<D>, getState: () => S) => R): R;
99
}
1010
}
1111

12-
type Thunk<S, O> = (dispatch: Dispatch<S>, getState?: () => S) => O;
12+
type Thunk<S, O> = (dispatch: Dispatch<Action>, getState?: () => S) => O;
1313

1414
const thunkMiddleware: Middleware =
1515
<S>({dispatch, getState}: MiddlewareAPI<S>) =>
16-
(next: Dispatch<S>) =>
16+
(next: Dispatch<Action>) =>
1717
<A extends Action, B>(action: A | Thunk<S, B>): B|Action =>
1818
typeof action === 'function' ?
1919
(<Thunk<S, B>>action)(dispatch, getState) :
@@ -51,7 +51,7 @@ const storeWithThunkMiddleware = createStore(
5151
);
5252

5353
storeWithThunkMiddleware.dispatch(
54-
(dispatch: Dispatch<State>, getState: () => State) => {
54+
(dispatch: Dispatch<Action>, getState: () => State) => {
5555
const todos: string[] = getState().todos;
5656
dispatch({type: 'ADD_TODO'})
5757
}

0 commit comments

Comments
 (0)