Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit ca4d224

Browse files
committed
build: upgrade to typescript 3.2.2
1 parent f3995de commit ca4d224

File tree

10 files changed

+36
-34
lines changed

10 files changed

+36
-34
lines changed

lib/common/fetch.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*/
88

99
Zone.__load_patch('fetch', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
10+
interface FetchTaskData extends TaskData {
11+
fetchArgs?: any[];
12+
}
1013
let fetch = global['fetch'];
1114
if (typeof fetch !== 'function') {
1215
return;
@@ -46,7 +49,7 @@ Zone.__load_patch('fetch', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
4649
const signal = options && options.signal;
4750
return new Promise((res, rej) => {
4851
const task = Zone.current.scheduleMacroTask(
49-
'fetch', placeholder, args,
52+
'fetch', placeholder, {fetchArgs: args} as FetchTaskData,
5053
() => {
5154
let fetchPromise;
5255
let zone = Zone.current;

lib/common/to-string.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ Zone.__load_patch('toString', (global: any) => {
2121
const originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL];
2222
if (originalDelegate) {
2323
if (typeof originalDelegate === 'function') {
24-
return originalFunctionToString.apply(this[ORIGINAL_DELEGATE_SYMBOL], arguments);
24+
return originalFunctionToString.call(originalDelegate);
2525
} else {
2626
return Object.prototype.toString.call(originalDelegate);
2727
}
2828
}
2929
if (this === Promise) {
3030
const nativePromise = global[PROMISE_SYMBOL];
3131
if (nativePromise) {
32-
return originalFunctionToString.apply(nativePromise, arguments);
32+
return originalFunctionToString.call(nativePromise);
3333
}
3434
}
3535
if (this === Error) {
3636
const nativeError = global[ERROR_SYMBOL];
3737
if (nativeError) {
38-
return originalFunctionToString.apply(nativeError, arguments);
38+
return originalFunctionToString.call(nativeError);
3939
}
4040
}
4141
}
42-
return originalFunctionToString.apply(this, arguments);
42+
return originalFunctionToString.call(this);
4343
};
4444
(newFunctionToString as any)[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString;
4545
Function.prototype.toString = newFunctionToString;
@@ -52,6 +52,6 @@ Zone.__load_patch('toString', (global: any) => {
5252
if (this instanceof Promise) {
5353
return PROMISE_OBJECT_TO_STRING;
5454
}
55-
return originalObjectToString.apply(this, arguments);
55+
return originalObjectToString.call(this);
5656
};
5757
});

lib/common/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const internalWindow: any = isWindowExists ? window : undefined;
5757
const _global: any = isWindowExists && internalWindow || typeof self === 'object' && self || global;
5858

5959
const REMOVE_ATTRIBUTE = 'removeAttribute';
60-
const NULL_ON_PROP_VALUE: any[] = [null];
60+
const NULL_ON_PROP_VALUE: [any] = [null];
6161

6262
export function bindArguments(args: any[], source: string): any[] {
6363
for (let i = args.length - 1; i >= 0; i--) {

lib/jasmine/jasmine.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -188,26 +188,21 @@
188188
}
189189
interface QueueRunnerAttrs {
190190
queueableFns: {fn: Function}[];
191-
onComplete: () => void;
192191
clearStack: (fn: any) => void;
193-
onException: (error: any) => void;
194192
catchException: () => boolean;
193+
fail: () => void;
194+
onComplete: () => void;
195+
onException: (error: any) => void;
195196
userContext: any;
196197
timeout: {setTimeout: Function; clearTimeout: Function};
197-
fail: () => void;
198198
}
199199

200200
const QueueRunner = (jasmine as any).QueueRunner as {
201201
new (attrs: QueueRunnerAttrs): QueueRunner;
202202
};
203203
(jasmine as any).QueueRunner = (function(_super) {
204204
__extends(ZoneQueueRunner, _super);
205-
function ZoneQueueRunner(attrs: {
206-
onComplete: Function;
207-
userContext?: any;
208-
timeout?: {setTimeout: Function; clearTimeout: Function};
209-
onException?: (error: any) => void;
210-
}) {
205+
function ZoneQueueRunner(attrs: QueueRunnerAttrs) {
211206
attrs.onComplete = (fn => () => {
212207
// All functions are done, clear the test zone.
213208
this.testProxyZone = null;

lib/rxjs/rxjs-fake-async.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import {asapScheduler, asyncScheduler, Scheduler} from 'rxjs';
1010

1111
Zone.__load_patch('rxjs.Scheduler.now', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
1212
api.patchMethod(Scheduler, 'now', (delegate: Function) => (self: any, args: any[]) => {
13-
return Date.now.apply(self, args);
13+
return Date.now.call(self);
1414
});
1515
api.patchMethod(asyncScheduler, 'now', (delegate: Function) => (self: any, args: any[]) => {
16-
return Date.now.apply(self, args);
16+
return Date.now.call(self);
1717
});
1818
api.patchMethod(asapScheduler, 'now', (delegate: Function) => (self: any, args: any[]) => {
19-
return Date.now.apply(self, args);
19+
return Date.now.call(self);
2020
});
2121
});

lib/rxjs/rxjs.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ import {Observable, Subscriber, Subscription} from 'rxjs';
151151
if (subscriptionZone && subscriptionZone !== currentZone) {
152152
return subscriptionZone.run(next, this, arguments, nextSource);
153153
} else {
154-
return next.apply(this, arguments);
154+
return next.call(this, arguments as any);
155155
}
156156
};
157157

@@ -164,7 +164,7 @@ import {Observable, Subscriber, Subscription} from 'rxjs';
164164
if (subscriptionZone && subscriptionZone !== currentZone) {
165165
return subscriptionZone.run(error, this, arguments, errorSource);
166166
} else {
167-
return error.apply(this, arguments);
167+
return error.apply(this, arguments as any);
168168
}
169169
};
170170

@@ -177,7 +177,7 @@ import {Observable, Subscriber, Subscription} from 'rxjs';
177177
if (subscriptionZone && subscriptionZone !== currentZone) {
178178
return subscriptionZone.run(complete, this, arguments, completeSource);
179179
} else {
180-
return complete.apply(this, arguments);
180+
return complete.call(this);
181181
}
182182
};
183183
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"ts-loader": "^0.6.0",
107107
"tslint": "^4.1.1",
108108
"tslint-eslint-rules": "^3.1.0",
109-
"typescript": "^3.0.3",
109+
"typescript": "^3.2.2",
110110
"vrsource-tslint-rules": "^4.0.0",
111111
"webdriver-manager": "^12.0.6",
112112
"webdriverio": "^4.8.0",

test/browser/XMLHttpRequest.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ describe('XMLHttpRequest', function() {
386386
};
387387
expect(req.onreadystatechange).toBe(listener);
388388
req.onreadystatechange = function() {
389-
return listener.apply(this, arguments);
389+
return listener.call(this);
390390
};
391391
req.send();
392392
});

test/common/Promise.spec.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe(
103103

104104
xit('should ensure that Promise this is instanceof Promise', () => {
105105
expect(() => {
106-
Promise.call({}, null);
106+
Promise.call({}, () => null);
107107
}).toThrowError('Must be an instanceof Promise.');
108108
});
109109

@@ -488,18 +488,22 @@ describe(
488488
});
489489

490490
describe('Promise subclasses', function() {
491-
class MyPromise {
491+
class MyPromise<T> {
492492
private _promise: Promise<any>;
493493
constructor(init: any) {
494494
this._promise = new Promise(init);
495495
}
496496

497-
catch() {
498-
return this._promise.catch.apply(this._promise, arguments);
497+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>)|
498+
undefined|null): Promise<T|TResult> {
499+
return this._promise.catch.call(this._promise, onrejected);
499500
};
500501

501-
then() {
502-
return this._promise.then.apply(this._promise, arguments);
502+
then<TResult1 = T, TResult2 = never>(
503+
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>)|undefined|null,
504+
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>)|undefined|
505+
null): Promise<any> {
506+
return this._promise.then.call(this._promise, onfulfilled, onrejected);
503507
};
504508
}
505509

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -6472,10 +6472,10 @@ typedarray@^0.0.6, typedarray@~0.0.5:
64726472
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
64736473
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
64746474

6475-
typescript@^3.0.3:
6476-
version "3.0.3"
6477-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.3.tgz#4853b3e275ecdaa27f78fda46dc273a7eb7fc1c8"
6478-
integrity sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==
6475+
typescript@^3.2.2:
6476+
version "3.3.3333"
6477+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6"
6478+
integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==
64796479

64806480
64816481
version "2.6.4"

0 commit comments

Comments
 (0)