Skip to content

Commit 885d5d2

Browse files
committed
improve typings
1 parent 1f47510 commit 885d5d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+6424
-1727
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
npm-debug.log
33
notes.md
4+
test/tests.md

lib/atom/editor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function open(filePath, options) {
4444
}
4545
exports.open = open;
4646
function set(text) {
47-
getEditor().then(function (editor) {
47+
return getEditor().then(function (editor) {
4848
editor.setText(text);
4949
editor.insertNewline();
5050
editor.moveToBottom();
@@ -56,7 +56,7 @@ function insert(text, options) {
5656
options = Object.assign(options, {
5757
autoIndent: true
5858
});
59-
getEditor().then(function (editor) {
59+
return getEditor().then(function (editor) {
6060
editor.moveToBottom();
6161
editor.insertText(text, options);
6262
editor.insertNewline();

lib/atom/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
'use strict';
22
var render_1 = require('../components/render');
3+
var polyfills_1 = require('../services/polyfills');
34
var subscriptions_1 = require('./subscriptions');
45
var editor_1 = require('./editor');
56
var Main = (function () {
67
function Main() {
78
global.coderoad = {};
9+
polyfills_1.default();
810
editor_1.setAtomGlobals();
911
this.root = render_1.initRoot();
1012
}

lib/reducers/alert/alert.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var defaultAlert = {
66
action: '',
77
duration: 0
88
};
9-
var current = {};
9+
var current = defaultAlert;
1010
function alertReducer(alert, action) {
1111
if (alert === void 0) { alert = defaultAlert; }
1212
var statusBarAlert = document.getElementsByClassName('cr-alert-replay')[0];
@@ -52,7 +52,6 @@ function alertReducer(alert, action) {
5252
};
5353
return current;
5454
}
55-
return defaultAlert;
5655
default:
5756
return alert;
5857
}

lib/reducers/reducer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ var editor_actions_1 = require('./editor-actions/editor-actions');
1414
var tutorials_1 = require('./tutorials/tutorials');
1515
var log_1 = require('./log/log');
1616
var hint_1 = require('./hint/hint');
17-
var solution_1 = require('./solution/solution');
1817
Object.defineProperty(exports, "__esModule", { value: true });
1918
exports.default = redux_1.combineReducers({
2019
project: project_1.default,
@@ -30,6 +29,5 @@ exports.default = redux_1.combineReducers({
3029
editorActions: editor_actions_1.default,
3130
tutorials: tutorials_1.default,
3231
log: log_1.default,
33-
hint: hint_1.default,
34-
solution: solution_1.default
32+
hint: hint_1.default
3533
});

lib/reducers/run-tests/test-result.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22
var _base_1 = require('../../_base');
33
var Action = require('../../actions/actions');
4-
;
54
function handleResult(result) {
65
_base_1.store.dispatch(Action.testComplete());
76
if (!result.pass) {

lib/reducers/solution/solution.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
"use strict";
2-
function solutionReducer(solution, action) {
3-
if (solution === void 0) { solution = []; }
4-
switch (action.type) {
5-
default:
6-
return solution;
7-
}
8-
}
9-
Object.defineProperty(exports, "__esModule", { value: true });
10-
exports.default = solutionReducer;

lib/reducers/task-tests/concat-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function concatTests(targetFile, files) {
66
}
77
files.forEach(function (tests) {
88
if (typeof tests === 'string') {
9-
readAppend(targetFile, test);
9+
readAppend(targetFile, tests);
1010
}
1111
else if (Object.prototype.toString.call(tests) === '[object Array]') {
1212
tests.forEach(function (test) {

lib/services/polyfills.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use strict";
2+
function loadPolyfills() {
3+
if (typeof Object.assign != 'function') {
4+
(function () {
5+
Object.assign = function (target) {
6+
'use strict';
7+
if (target === undefined || target === null) {
8+
throw new TypeError('Cannot convert undefined or null to object');
9+
}
10+
var output = Object(target);
11+
for (var index = 1; index < arguments.length; index++) {
12+
var source = arguments[index];
13+
if (source !== undefined && source !== null) {
14+
for (var nextKey in source) {
15+
if (source.hasOwnProperty(nextKey)) {
16+
output[nextKey] = source[nextKey];
17+
}
18+
}
19+
}
20+
}
21+
return output;
22+
};
23+
})();
24+
}
25+
}
26+
Object.defineProperty(exports, "__esModule", { value: true });
27+
exports.default = loadPolyfills;
28+
;

lib/services/setGlobals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ function loadRepo(config) {
5050
}
5151
global.coderoad.repo = repo;
5252
}
53-
global.coderoad.edit = config.config.edit && !!repo || false;
53+
global.coderoad.edit = config.config.edit && !!global.coderoad.repo || false;
5454
}

0 commit comments

Comments
 (0)