Skip to content

Commit 6bab295

Browse files
committed
Updates to TypeScript 3.2.1
1 parent cf795a6 commit 6bab295

File tree

7 files changed

+40
-56
lines changed

7 files changed

+40
-56
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,15 +4428,15 @@
44284428
"imagemin-webpack-plugin": "2.3.0",
44294429
"mini-css-extract-plugin": "0.4.4",
44304430
"node-sass": "4.10.0",
4431-
"prettier": "1.15.2",
4431+
"prettier": "1.15.3",
44324432
"prettier-tslint": "0.4.0",
44334433
"sass-loader": "7.1.0",
44344434
"terser-webpack-plugin": "1.1.0",
44354435
"tslint": "5.11.0",
44364436
"tslint-loader": "3.5.4",
44374437
"tslint-prettiest": "0.0.1",
44384438
"ts-loader": "5.3.1",
4439-
"typescript": "3.1.6",
4439+
"typescript": "3.2.1",
44404440
"vsce": "1.53.2",
44414441
"vscode": "1.1.22",
44424442
"webpack": "4.26.1",

src/system/function.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,27 @@ export namespace Functions {
5050
let pending = false;
5151

5252
const debounced = _debounce(
53-
(function(this: any) {
53+
(function(this: any, ...args: any[]) {
5454
pending = false;
55-
return fn.apply(this, arguments);
55+
return fn.apply(this, args);
5656
} as any) as T,
5757
wait,
5858
options
5959
) as T & IDeferrable;
6060

61-
const tracked = (function(this: any) {
61+
const tracked = (function(this: any, ...args: any[]) {
6262
pending = true;
63-
return debounced.apply(this, arguments);
63+
return debounced.apply(this, args);
6464
} as any) as T & IDeferrable;
6565

6666
tracked.pending = function() {
6767
return pending;
6868
};
6969
tracked.cancel = function() {
70-
return debounced.cancel.apply(debounced, arguments);
70+
return debounced.cancel.apply(debounced);
7171
};
7272
tracked.flush = function(...args: any[]) {
73-
return debounced.flush.apply(debounced, arguments);
73+
return debounced.flush.apply(debounced, args);
7474
};
7575

7676
return tracked;

src/ui/settings/app.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,13 @@ export class SettingsApp extends App<SettingsBootstrap> {
3232
}
3333

3434
protected onBind() {
35-
const onSectionHeaderClicked = this.onSectionHeaderClicked.bind(this);
36-
DOM.listenAll('.section__header', 'click', function(this: HTMLInputElement) {
37-
return onSectionHeaderClicked(this, ...arguments);
38-
});
35+
const me = this;
3936

40-
const onActionLinkClicked = this.onActionLinkClicked.bind(this);
41-
DOM.listenAll('[data-action]', 'click', function(this: HTMLAnchorElement) {
42-
return onActionLinkClicked(this, ...arguments);
37+
DOM.listenAll('.section__header', 'click', function(this: HTMLInputElement, e: Event) {
38+
return me.onSectionHeaderClicked(this, e as MouseEvent);
39+
});
40+
DOM.listenAll('[data-action]', 'click', function(this: HTMLAnchorElement, e: Event) {
41+
return me.onActionLinkClicked(this, e as MouseEvent);
4342
});
4443
}
4544

src/ui/shared/app-base.ts

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export abstract class App<TBootstrap extends Bootstrap> {
173173

174174
el.scrollIntoView({
175175
block: 'start',
176-
behavior: 'instant'
176+
behavior: 'auto'
177177
});
178178
window.scrollBy(0, -height);
179179

@@ -223,42 +223,30 @@ export abstract class App<TBootstrap extends Bootstrap> {
223223
private bind() {
224224
this.onBind();
225225

226-
const onMessageReceived = this.onMessageReceived.bind(this);
227-
window.addEventListener('message', onMessageReceived);
226+
window.addEventListener('message', this.onMessageReceived.bind(this));
227+
228+
const me = this;
228229

229-
const onInputChecked = this.onInputChecked.bind(this);
230230
DOM.listenAll('input[type=checkbox].setting', 'change', function(this: HTMLInputElement) {
231-
return onInputChecked(this, ...arguments);
231+
return me.onInputChecked(this);
232232
});
233-
234-
const onInputBlurred = this.onInputBlurred.bind(this);
235233
DOM.listenAll('input[type=text].setting, input:not([type]).setting', 'blur', function(this: HTMLInputElement) {
236-
return onInputBlurred(this, ...arguments);
234+
return me.onInputBlurred(this);
237235
});
238-
239-
const onInputFocused = this.onInputFocused.bind(this);
240236
DOM.listenAll('input[type=text].setting, input:not([type]).setting', 'focus', function(this: HTMLInputElement) {
241-
return onInputFocused(this, ...arguments);
237+
return me.onInputFocused(this);
242238
});
243-
244-
const onInputSelected = this.onInputSelected.bind(this);
245-
DOM.listenAll('select.setting', 'change', function(this: HTMLInputElement) {
246-
return onInputSelected(this, ...arguments);
239+
DOM.listenAll('select.setting', 'change', function(this: HTMLSelectElement) {
240+
return me.onInputSelected(this);
247241
});
248-
249-
const onTokenMouseDown = this.onTokenMouseDown.bind(this);
250-
DOM.listenAll('[data-token]', 'mousedown', function(this: HTMLElement) {
251-
return onTokenMouseDown(this, ...arguments);
242+
DOM.listenAll('[data-token]', 'mousedown', function(this: HTMLElement, e: Event) {
243+
return me.onTokenMouseDown(this, e as MouseEvent);
252244
});
253-
254-
const onPopupMouseDown = this.onPopupMouseDown.bind(this);
255-
DOM.listenAll('.popup', 'mousedown', function(this: HTMLElement) {
256-
return onPopupMouseDown(this, ...arguments);
245+
DOM.listenAll('.popup', 'mousedown', function(this: HTMLElement, e: Event) {
246+
return me.onPopupMouseDown(this, e as MouseEvent);
257247
});
258-
259-
const onJumpToLinkClicked = this.onJumpToLinkClicked.bind(this);
260-
DOM.listenAll('a.jump-to[href^="#"]', 'click', function(this: HTMLAnchorElement) {
261-
return onJumpToLinkClicked(this, ...arguments);
248+
DOM.listenAll('a.jump-to[href^="#"]', 'click', function(this: HTMLAnchorElement, e: Event) {
249+
return me.onJumpToLinkClicked(this, e as MouseEvent);
262250
});
263251
}
264252

src/ui/shared/dom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export namespace DOM {
3535
// return element.querySelectorAll(selectors) as NodeList<T>;
3636
// }
3737

38-
export function listenAll(selector: string, name: string, listener: EventListenerOrEventListenerObject) {
39-
const els = document.querySelectorAll(selector);
38+
export function listenAll(selector: string, name: string, listener: EventListener) {
39+
const els = (document.querySelectorAll(selector) as unknown) as Element[];
4040
for (const el of els) {
4141
el.addEventListener(name, listener, false);
4242
}

ui.tsconfig.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
{
2-
"version": "2.0.0",
3-
"compileOnSave": false,
42
"compilerOptions": {
53
"forceConsistentCasingInFileNames": true,
6-
"lib": ["es5", "dom", "dom.iterable", "es2015", "es2015.iterable", "es2016"],
4+
"lib": ["dom", "dom.iterable", "es2015", "es2015.iterable", "es2016"],
75
"module": "es2015",
86
"moduleResolution": "node",
97
"noFallthroughCasesInSwitch": true,
108
"noImplicitReturns": true,
11-
"noUnusedLocals": true,
9+
"noUnusedLocals": false,
1210
"outDir": "dist/ui",
13-
"removeComments": true,
1411
"rootDir": "./src/ui",
1512
"skipLibCheck": true,
1613
"sourceMap": true,

0 commit comments

Comments
 (0)