Skip to content

Commit 3f1c9f9

Browse files
committed
update types for new redux-thunk.d.ts
1 parent b399a7f commit 3f1c9f9

File tree

13 files changed

+38
-31
lines changed

13 files changed

+38
-31
lines changed

lib/modules/alert/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22
var types_1 = require('./types');
33
function alertOpen(alert) {
4-
return function (dispatch, getState) {
4+
return function (dispatch) {
55
dispatch({ type: types_1.ALERT_OPEN, payload: { alert: alert } });
66
};
77
}

lib/modules/tests/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function getTestFilter(result) {
7171
}
7272
}
7373
function testComplete(result) {
74-
return function (dispatch, getState) {
74+
return function (dispatch) {
7575
switch (true) {
7676
case result.completed:
7777
dispatch(testResult(result));

lib/modules/tutorials/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var types_1 = require('./types');
44
var actions_2 = require('../tutorial/actions');
55
exports.tutorialSet = actions_2.tutorialSet;
66
function tutorialUpdate(title) {
7-
return function (dispatch, getState) {
7+
return function (dispatch) {
88
var alert = {
99
message: "run `npm install --save-dev " + title + "`",
1010
action: 'note',

src/modules/alert/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {ALERT_CLOSE, ALERT_OPEN, ALERT_REPLAY} from './types';
22

3-
export function alertOpen(alert: Object): ReduxThunk.ThunkInterface {
4-
return (dispatch, getState): void => {
3+
export function alertOpen(alert: Object): Redux.ThunkAction<any, {}, {}> {
4+
return (dispatch): void => {
55
dispatch({ type: ALERT_OPEN, payload: { alert } });
66
};
77
}

src/modules/editor/actions.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export function editorInsert(content: string): Action {
1414
}
1515

1616
// opens file within a directory
17-
export function editorOpen(file: string, options: Object) {
17+
export function editorOpen(file: string, options: Object):
18+
Redux.ThunkAction<any, {dir: string}, {}> {
1819
return (dispatch, getState) => {
1920
file = join(getState().dir, file);
2021
dispatch({ type: EDITOR_OPEN, payload: { file, options } });
@@ -33,7 +34,8 @@ export function editorScroll(content: string): Action {
3334
return { type: EDITOR_SCROLL, payload: { content } };
3435
}
3536

36-
export function editorWriteFileFromContent(to: string, content: string) {
37+
export function editorWriteFileFromContent(to: string, content: string):
38+
Redux.ThunkAction<any, {dir: string}, {}> {
3739
return (dispatch, getState) => {
3840
const { dir } = getState();
3941
dispatch({
@@ -43,7 +45,8 @@ export function editorWriteFileFromContent(to: string, content: string) {
4345
};
4446
}
4547

46-
export function editorWriteFileFromFile(to: string, from: string) {
48+
export function editorWriteFileFromFile(to: string, from: string):
49+
Redux.ThunkAction<any, any, {}> {
4750
return (dispatch, getState) => {
4851
const { dir, tutorial } = getState();
4952
const tutorialDir = tutorial.config.dir;

src/modules/page/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {hintPositionSet, routeSet, testLoad} from '../../actions';
22
import {PAGE_SET} from './types';
33

4-
export function pageNext(): ReduxThunk.ThunkInterface | Action {
4+
export function pageNext(): Redux.ThunkAction<any, any, {}> {
55
return (dispatch, getState): void => {
66
let {pagePosition} = getState();
77
dispatch(pageSet(pagePosition + 1));
88
};
99
}
1010

11-
export function pageSet(pagePosition = 0): ReduxThunk.ThunkInterface {
11+
export function pageSet(pagePosition = 0): Redux.ThunkAction<any, any, {}> {
1212
return (dispatch, getState): void => {
1313
const state = getState();
1414
const {progress, tutorial, route} = state;

src/modules/progress/actions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
PROGRESS_COMPLETE_PAGE, PROGRESS_COMPLETE_TUTORIAL, PROGRESS_LOAD, PROGRESS_PAGE_POSITION
44
} from './types';
55

6-
export function progressLoad(): ReduxThunk.ThunkInterface {
6+
export function progressLoad(): Redux.ThunkAction<any, any, {}> {
77
return (dispatch, getState) => {
88
const {tutorial} = getState();
99
dispatch({ type: PROGRESS_LOAD, payload: { tutorial } });
@@ -12,14 +12,15 @@ export function progressLoad(): ReduxThunk.ThunkInterface {
1212
};
1313
}
1414

15-
function _progressPagePosition() {
15+
function _progressPagePosition(): Redux.ThunkAction<any, any, {}> {
1616
return (dispatch, getState) => {
1717
const {progress} = getState();
1818
dispatch({ type: PROGRESS_PAGE_POSITION, payload: { progress } });
1919
};
2020
}
2121

22-
export function progressCompletePage(completed = true): ReduxThunk.ThunkInterface {
22+
export function progressCompletePage(completed = true):
23+
Redux.ThunkAction<any, any, any> {
2324
return (dispatch, getState) => {
2425
const {pagePosition, progress, tutorial} = getState();
2526
// all pages are true, tutorial complete
@@ -35,7 +36,8 @@ export function progressCompletePage(completed = true): ReduxThunk.ThunkInterfac
3536
};
3637
}
3738

38-
export function progressCompleteTutorial(completed = true): ReduxThunk.ThunkInterface {
39+
export function progressCompleteTutorial(completed = true):
40+
Redux.ThunkAction<any, any, any> {
3941
return (dispatch, getState) => {
4042
const {tutorial} = getState();
4143
dispatch({ type: PROGRESS_COMPLETE_TUTORIAL, payload: { tutorial, completed } });

src/modules/route/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {ROUTE_SET} from './types';
22

3-
export function routeSet(route: string): ReduxThunk.ThunkInterface {
3+
export function routeSet(route: string): Redux.ThunkAction<any, any, {}> {
44
return (dispatch, getState) => {
55
if (getState.route !== route) {
66
dispatch({ type: ROUTE_SET, payload: { route } });

src/modules/setup/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {SETUP_PACKAGE, SETUP_VERIFY} from './types';
22

3-
export function setupVerify(): ReduxThunk.ThunkInterface {
3+
export function setupVerify(): Redux.ThunkAction<any, any, {}> {
44
return (dispatch, getState): void => {
55
dispatch(setupPackage());
66
const {dir, packageJson} = getState();
77
dispatch({ type: SETUP_VERIFY, payload: { dir, packageJson } });
88
};
99
}
1010

11-
export function setupPackage(): ReduxThunk.ThunkInterface {
11+
export function setupPackage(): Redux.ThunkAction<any, {dir: string}, {}> {
1212
return (dispatch, getState): void => {
1313
const {dir} = getState();
1414
dispatch({ type: SETUP_PACKAGE, payload: { dir } });

src/modules/tests/actions.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import {alertOpen, hintPositionSet, progressCompletePage} from '../../actions';
22
import getTestName from './test-run/testName';
33
import {TEST_COMPLETE, TEST_LOAD, TEST_RESULT, TEST_RUN} from './types';
44

5-
export function testLoad() {
5+
export function testLoad(): Redux.ThunkAction<any, any, {}> {
66
return (dispatch, getState): void => {
77
const { dir, pagePosition, tutorial, taskTests } = getState();
88
const testFile = getTestName({tutorial, pagePosition});
9-
109
dispatch({
1110
type: TEST_LOAD, payload: {
1211
dir,
@@ -18,7 +17,7 @@ export function testLoad() {
1817
};
1918
}
2019

21-
export function testRun(): ReduxThunk.ThunkInterface {
20+
export function testRun(): Redux.ThunkAction<any, any, {}> {
2221
return (dispatch, getState): void => {
2322
// less than a second since the last test run, skip
2423
const timeSinceLastTestRun = performance.now() - getState().testRun.time;
@@ -35,7 +34,8 @@ export function testRun(): ReduxThunk.ThunkInterface {
3534
};
3635
}
3736

38-
export function testResult(result: Test.Result): ReduxThunk.ThunkInterface {
37+
export function testResult(result: Test.Result):
38+
Redux.ThunkAction<any, any, {}> {
3939
return (dispatch, getState): void => {
4040
const {taskActions, progress, pagePosition} = getState();
4141
const filter: string = getTestFilter(result);
@@ -76,8 +76,9 @@ function getTestFilter(result: Test.Result): string {
7676
}
7777
}
7878

79-
export function testComplete(result: Test.Result) {
80-
return (dispatch, getState): void => {
79+
export function testComplete(result: Test.Result):
80+
Redux.ThunkAction<any, any, {}> {
81+
return (dispatch): void => {
8182
switch (true) {
8283
// all complete
8384
case result.completed:

src/modules/tutorial/actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {routeSet} from '../../actions';
22
import {TUTORIAL_SET} from './types';
33

4-
export function tutorialSet({name, version}): ReduxThunk.ThunkInterface {
4+
export function tutorialSet({name, version}):
5+
Redux.ThunkAction<any, {dir: string}, {}> {
56
return (dispatch, getState) => {
67
const {dir} = getState();
78
dispatch({ type: TUTORIAL_SET, payload: {name, dir, version }});

src/modules/tutorials/actions.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import {alertOpen} from '../alert/actions';
22
import {TUTORIALS_FIND, TUTORIAL_UPDATE} from './types';
33
export {tutorialSet} from '../tutorial/actions';
44

5-
export function tutorialUpdate(title: string): ReduxThunk.ThunkInterface {
6-
return (dispatch, getState) => {
5+
export function tutorialUpdate(title: string):
6+
Redux.ThunkAction<any, {}, {}> {
7+
return (dispatch) => {
78
const alert = {
89
message: `run \`npm install --save-dev ${title}\``,
910
action: 'note',
@@ -14,7 +15,7 @@ export function tutorialUpdate(title: string): ReduxThunk.ThunkInterface {
1415
};
1516
}
1617

17-
export function tutorialsFind(): ReduxThunk.ThunkInterface {
18+
export function tutorialsFind(): Redux.ThunkAction<any, {dir: string}, {}> {
1819
return (dispatch, getState) => {
1920
const {dir} = getState();
2021
dispatch({ type: TUTORIALS_FIND, payload: { dir } });

src/typings/index.d.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Globals
22
/// <reference path="globals/atom/index.d.ts" />
33
/// <reference path="globals/es6-promise/index.d.ts" />
4-
/// <reference path="globals/node/index.d.ts" />
5-
/// <reference path="globals/react-dom/index.d.ts" />
6-
/// <reference path="globals/react/index.d.ts" />
7-
/// <reference path="globals/es6-promise/index.d.ts" />
84
/// <reference path="globals/marked/index.d.ts" />
95
/// <reference path="globals/material-ui/index.d.ts" />
6+
/// <reference path="globals/node/index.d.ts" />
7+
/// <reference path="globals/react/index.d.ts" />
8+
/// <reference path="globals/react-dom/index.d.ts" />
109
/// <reference path="globals/react-redux/index.d.ts" />
1110
/// <reference path="globals/react-tap-event-plugin/index.d.ts" />
1211
/// <reference path="globals/redux/index.d.ts" />

0 commit comments

Comments
 (0)