Skip to content

Commit 1e7c3d7

Browse files
committed
improved typings
1 parent 65ff242 commit 1e7c3d7

File tree

28 files changed

+1194
-106
lines changed

28 files changed

+1194
-106
lines changed

lib/atom/main.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ var subscriptions_1 = require('./subscriptions');
55
var editor_1 = require('./editor');
66
var Main = (function () {
77
function Main() {
8-
window.coderoad = {};
8+
window.coderoad = {
9+
dir: null
10+
};
911
polyfills_1.default();
1012
editor_1.setAtomGlobals();
1113
this.root = render_1.initRoot();
@@ -22,7 +24,7 @@ var Main = (function () {
2224
};
2325
Main.prototype.deactivate = function () {
2426
if (this.statusBarTile) {
25-
this.statusBarTile.dispose();
27+
this.statusBarTile.destroy();
2628
this.statusBarTile = null;
2729
}
2830
subscriptions_1.onDeactivateSubscriptionsAndUnmount();

lib/components/page/chapter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
var React = require('react');
23
var _components_1 = require('../_components');
34
Object.defineProperty(exports, "__esModule", { value: true });
45
exports.default = function (_a) {

lib/components/page/page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ var default_1 = (function (_super) {
7575
default_1.prototype.displayHint = function (task) {
7676
if (task && task.hints && task.hints.length) {
7777
if (this.state.hintPos < task.hints.length - 1) {
78-
this.setState({ hintPos: this.state.hintPos += 1 });
78+
this.setState({ hintPos: this.state.hintPos += 1, taskPos: this.state.taskPos });
7979
}
8080
}
8181
else {
82-
this.setState({ hintPos: -1 });
82+
this.setState({ hintPos: -1, taskPos: this.state.taskPos });
8383
}
8484
};
8585
default_1.prototype.hintsShown = function (task) {

lib/components/progress/progress.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ var React = require('react');
1717
var react_redux_1 = require('react-redux');
1818
var Action = require('../../actions/actions');
1919
var material_ui_1 = require('material-ui');
20-
var classNames = require('classnames');
2120
var Completed = require('material-ui/lib/svg-icons/toggle/check-box');
2221
var Current = require('material-ui/lib/svg-icons/av/play-circle-filled');
2322
var AllCompleted = require('material-ui/lib/svg-icons/action/done-all');

lib/components/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function unmount(target) {
1717
ReactDOM.unmountComponentAtNode(target);
1818
}
1919
exports.unmount = unmount;
20-
function initRoot(canStart) {
20+
function initRoot() {
2121
var root = document.createElement('div');
2222
root.setAttribute('id', rootName);
2323
root.hidden = true;

lib/reducers/editor-actions/actions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ function getParams(actionString) {
2121
var params = actionString.substring(command.length + 1, actionString.length - 1);
2222
if (!params.length) {
2323
console.error('Error loading editor action params ', actionString);
24-
return '';
24+
return null;
2525
}
26-
params = parser_1.parseParams.getParams(params);
27-
return params;
26+
var paramsList = parser_1.parseParams.getParams(params);
27+
return paramsList;
2828
}
2929
exports.getParams = getParams;
3030
function createObjectFromKeyValString(string) {

lib/reducers/editor-actions/editor-actions.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ var _ = require('lodash');
44
var actions_1 = require('./actions');
55
function handleEditorActions(actionArray) {
66
if (actionArray && actionArray.length) {
7-
return Promise.all(actionArray.map(function (actionString) { return actions_1.editorActions(actionString); }));
7+
actionArray.map(function (actionString) { return actions_1.editorActions(actionString); });
88
}
99
}
1010
var currentTaskPosition = 0;
11+
var actions;
1112
function editorActionsReducer(editorActions, action) {
1213
if (editorActions === void 0) { editorActions = []; }
1314
switch (action.type) {
1415
case Type.SET_PAGE:
15-
var actions = action.payload.actions;
16+
actions = action.payload.actions;
1617
currentTaskPosition = 0;
1718
handleEditorActions(actions.shift());
1819
return actions;
1920
case Type.TEST_RESULT:
20-
var actions = action.payload.actions;
21+
actions = action.payload.actions;
2122
var nextTaskPosition = action.payload.result.taskPosition;
2223
if (nextTaskPosition > currentTaskPosition) {
2324
_.times(handleEditorActions(actions.shift()), nextTaskPosition - currentTaskPosition);

lib/reducers/reducer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var run_tests_1 = require('./run-tests/run-tests');
1313
var editor_actions_1 = require('./editor-actions/editor-actions');
1414
var tutorials_1 = require('./tutorials/tutorials');
1515
var log_1 = require('./log/log');
16-
var hint_1 = require('./hint/hint');
1716
Object.defineProperty(exports, "__esModule", { value: true });
1817
exports.default = redux_1.combineReducers({
1918
project: project_1.default,
@@ -28,6 +27,5 @@ exports.default = redux_1.combineReducers({
2827
runTests: run_tests_1.default,
2928
editorActions: editor_actions_1.default,
3029
tutorials: tutorials_1.default,
31-
log: log_1.default,
32-
hint: hint_1.default
30+
log: log_1.default
3331
});

lib/services/package.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@ var PackageService = (function () {
4343
var _this = this;
4444
var config = this.config.config;
4545
return !tasks ? [] : tasks.map(function (task) {
46-
task.tests = !task.tests ? [] : task.tests.map(function (tests) {
47-
if (_.isString(tests)) {
48-
return [].concat(configTestString(config, _this.packageName, tests));
49-
}
50-
else {
51-
console.error('Invalid task test', tests);
52-
}
53-
});
46+
if (task.tests) {
47+
task.tests = task.tests.map(function (tests) {
48+
if (_.isString(tests)) {
49+
return [].concat(configTestString(config, _this.packageName, tests));
50+
}
51+
else {
52+
console.error('Invalid task test', tests);
53+
}
54+
});
55+
}
5456
return task;
5557
});
5658
};

src/atom/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class Main {
99
root: HTMLElement;
1010
statusBarTile: StatusBar.IStatusBarView;
1111
constructor() {
12-
window.coderoad = {};
12+
window.coderoad = {
13+
dir: null
14+
};
1315
loadPolyfills();
1416
setAtomGlobals();
1517
this.root = initRoot();
@@ -28,7 +30,7 @@ class Main {
2830
}
2931
deactivate(): void {
3032
if (this.statusBarTile) {
31-
this.statusBarTile.dispose();
33+
this.statusBarTile.destroy();
3234
this.statusBarTile = null;
3335
}
3436
onDeactivateSubscriptionsAndUnmount();

0 commit comments

Comments
 (0)