Skip to content

Commit 9d5899c

Browse files
author
Wang Zhongliang
committed
Upgrade TypeScript to ~2.4.0, Fix test cases
1 parent 086802a commit 9d5899c

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
"mocha": "^2.2.5",
7272
"redux": "4.0.0-beta.2",
7373
"rimraf": "^2.5.2",
74-
"typescript": "^1.8.10",
75-
"typescript-definition-tester": "0.0.4",
74+
"typescript": "~2.4.0",
75+
"typescript-definition-tester": "0.0.5",
7676
"webpack": "^1.12.14"
7777
}
7878
}

test/typescript.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
import {Store, Middleware} from 'redux';
2-
import thunk, {ThunkAction} from '../index.d.ts';
2+
import thunk, {ThunkAction} from '../index';
33

4+
type State = {
5+
foo: string
6+
};
7+
8+
type Actions = { type: 'FOO' };
49

5-
declare const store: Store<{foo: string}>;
10+
declare const store: Store<State, Actions>;
611

712
store.dispatch(dispatch => {
813
dispatch({type: 'FOO'});
914
});
1015

11-
store.dispatch((dispatch, getState) => {
12-
const state = getState();
16+
function testGetState(): ThunkAction<void, State, {}, Actions> {
17+
return (dispatch, getState) => {
18+
const state = getState();
19+
const foo: string = state.foo;
20+
};
21+
}
1322

14-
const foo: string = state.foo;
15-
});
23+
store.dispatch(testGetState());
1624

1725
const middleware: Middleware = thunk.withExtraArgument('bar');
1826

0 commit comments

Comments
 (0)